diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-06-22 22:38:59 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-06-22 22:38:59 -0400 |
commit | ebda15e4b5fe4d2e154526befcc6b9ad8f635813 (patch) | |
tree | 4578958f2488f5be9afad3772cd27324a1d9ef04 | |
parent | a9de982c343b0d83078d8e46b1a06e483c8595ec (diff) | |
parent | c239c57d3c9a8ddff7db6ed20e836844b17efdae (diff) | |
download | tor-ebda15e4b5fe4d2e154526befcc6b9ad8f635813.tar tor-ebda15e4b5fe4d2e154526befcc6b9ad8f635813.tar.gz |
Merge remote-tracking branch 'public/bug6211' into maint-0.2.3
-rw-r--r-- | changes/bug6211 | 4 | ||||
-rw-r--r-- | src/or/connection_edge.c | 17 |
2 files changed, 14 insertions, 7 deletions
diff --git a/changes/bug6211 b/changes/bug6211 new file mode 100644 index 000000000..2c8d9b8e7 --- /dev/null +++ b/changes/bug6211 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - Fix a bug that stopped AllowDotExit from working on addresses + that had an entry in the DNS cache. Fixes bug 6211; bugfix on + 0.2.3.17-beta. diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 210c2e03c..98920781a 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1100,8 +1100,8 @@ addressmap_match_superdomains(char *address) * address starts out as a non-exit address, and we remap it to an .exit * address at any point, then set *<b>exit_source_out</b> to the * address_entry_source_t of the first such rule. Set *<b>exit_source_out</b> - * to ADDRMAPSRC_NONE if there is no such rewrite. - * + * to ADDRMAPSRC_NONE if there is no such rewrite, or if the original address + * was a .exit. */ int addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out, @@ -1111,10 +1111,12 @@ addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out, int rewrites; time_t expires = TIME_MAX; addressmap_entry_source_t exit_source = ADDRMAPSRC_NONE; + char *addr_orig = tor_strdup(address); + char *log_addr_orig = NULL; for (rewrites = 0; rewrites < 16; rewrites++) { int exact_match = 0; - char *addr_orig = tor_strdup(escaped_safe_str_client(address)); + log_addr_orig = tor_strdup(escaped_safe_str_client(address)); ent = strmap_get(addressmap, address); @@ -1125,7 +1127,6 @@ addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out, !strcasecmp(address, ent->new_address)) { /* This is a rule like *.example.com example.com, and we just got * "example.com" */ - tor_free(addr_orig); goto done; } @@ -1133,7 +1134,6 @@ addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out, } if (!ent || !ent->new_address) { - tor_free(addr_orig); goto done; } @@ -1151,10 +1151,11 @@ addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out, } log_info(LD_APP, "Addressmap: rewriting %s to %s", - addr_orig, escaped_safe_str_client(address)); + log_addr_orig, escaped_safe_str_client(address)); if (ent->expires > 1 && ent->expires < expires) expires = ent->expires; - tor_free(addr_orig); + + tor_free(log_addr_orig); } log_warn(LD_CONFIG, "Loop detected: we've rewritten %s 16 times! Using it as-is.", @@ -1162,6 +1163,8 @@ addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out, /* it's fine to rewrite a rewrite, but don't loop forever */ done: + tor_free(addr_orig); + tor_free(log_addr_orig); if (exit_source_out) *exit_source_out = exit_source; if (expires_out) |