From c90097e74a21ef70d9df2ab70e5b211d7a26dc6d Mon Sep 17 00:00:00 2001 From: Robert Ransom Date: Sun, 13 Mar 2011 21:10:32 -0700 Subject: [PATCH 1/2] Remove dead code from rend_cache_lookup_v2_desc_as_dir hid_serv_responsible_for_desc_id's return value is never negative, and there is no need to search through the consensus to find out whether we are responsible for a descriptor ID before we look in our cache for a descriptor. --- changes/bug2748 | 5 +++++ src/or/rendcommon.c | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) create mode 100644 changes/bug2748 diff --git a/changes/bug2748 b/changes/bug2748 new file mode 100644 index 0000000000..647000d5f4 --- /dev/null +++ b/changes/bug2748 @@ -0,0 +1,5 @@ + o Minor bugfixes + - Remove dead code from rend_cache_lookup_v2_desc_as_dir. Fixes + part of bug 2748; bugfix on 0.2.0.10-alpha. + + diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index d6f5443815..ff3a4014a8 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -1008,13 +1008,6 @@ rend_cache_lookup_v2_desc_as_dir(const char *desc_id, const char **desc) safe_str(desc_id)); return -1; } - /* Determine if we are responsible. */ - if (hid_serv_responsible_for_desc_id(desc_id_digest) < 0) { - log_info(LD_REND, "Could not answer fetch request for v2 descriptor; " - "either we are no hidden service directory, or we are " - "not responsible for the requested ID."); - return -1; - } /* Lookup descriptor and return. */ e = digestmap_get(rend_cache_v2_dir, desc_id_digest); if (e) { From 96b929e743dc68f706f374c3448ed27c54a9cead Mon Sep 17 00:00:00 2001 From: Robert Ransom Date: Mon, 14 Mar 2011 01:11:30 -0700 Subject: [PATCH 2/2] Log malformed HS descriptor requests at the proper level This log message should be a 'protocol warning', not a 'warning'. --- changes/bug2748 | 5 +++++ src/or/rendcommon.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changes/bug2748 b/changes/bug2748 index 647000d5f4..b522560a92 100644 --- a/changes/bug2748 +++ b/changes/bug2748 @@ -1,5 +1,10 @@ o Minor bugfixes - Remove dead code from rend_cache_lookup_v2_desc_as_dir. Fixes part of bug 2748; bugfix on 0.2.0.10-alpha. + - Log malformed requests for rendezvous descriptors as protocol + warnings, not warnings. Also, use a more informative log + message in case someone sees it at log level warning without + prior info-level messages. Fixes the other part of bug 2748; + bugfix on 0.2.0.10-alpha. diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index ff3a4014a8..9acc641026 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -1004,8 +1004,10 @@ rend_cache_lookup_v2_desc_as_dir(const char *desc_id, const char **desc) tor_assert(rend_cache_v2_dir); if (base32_decode(desc_id_digest, DIGEST_LEN, desc_id, REND_DESC_ID_V2_LEN_BASE32) < 0) { - log_warn(LD_REND, "Descriptor ID contains illegal characters: %s", - safe_str(desc_id)); + log_fn(LOG_PROTOCOL_WARN, LD_REND, + "Rejecting v2 rendezvous descriptor request -- descriptor ID " + "contains illegal characters: %s", + safe_str(desc_id)); return -1; } /* Lookup descriptor and return. */