summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-11-14 10:14:23 -0500
committerNick Mathewson <nickm@torproject.org>2012-11-14 23:16:40 -0500
commit7197c9f14a60cd9e496fcd432a2fecb12b20f4dc (patch)
treeebc1240c12a0f3d30f4e6a1207f59b1fc5b3e032 /src
parent363cf024553741524c0c8cb9fa8b9226863c903b (diff)
downloadtor-7197c9f14a60cd9e496fcd432a2fecb12b20f4dc.tar.gz
tor-7197c9f14a60cd9e496fcd432a2fecb12b20f4dc.zip
Repair DNS NEXIST hijacking workaround
The code previously detected wildcarding and replaced wildcarded answers with DNS_STATUS_FAILED_PERMANENT. But that status variable was no longer used! Remove the status variable, and instead change the value of 'result' in evdns_callback. Thank goodness for compiler warnings. In this case, unused-but-set-variable. Thanks to Linus for finding this one.
Diffstat (limited to 'src')
-rw-r--r--src/or/dns.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 2804a0f086..5a7f07c9d8 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -1530,7 +1530,6 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
char *arg_ = arg;
uint8_t orig_query_type = arg_[0];
char *string_address = arg_ + 1;
- int status = DNS_RESOLVE_FAILED_PERMANENT;
tor_addr_t addr;
const char *hostname = NULL;
int was_wildcarded = 0;
@@ -1560,7 +1559,6 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
char *escaped_address;
uint32_t *addrs = addresses;
tor_addr_from_ipv4n(&addr, addrs[0]);
- status = DNS_RESOLVE_SUCCEEDED;
tor_addr_to_str(answer_buf, &addr, sizeof(answer_buf), 0);
escaped_address = esc_for_log(string_address);
@@ -1572,7 +1570,7 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
escaped_safe_str(answer_buf));
was_wildcarded = 1;
tor_addr_make_null(&addr, AF_INET); /* ???? */
- status = DNS_RESOLVE_FAILED_PERMANENT;
+ result = DNS_ERR_NOTEXIST;
} else {
log_debug(LD_EXIT, "eventdns said that %s resolves to %s",
safe_str(escaped_address),
@@ -1584,7 +1582,6 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
char *escaped_address;
struct in6_addr *addrs = addresses;
tor_addr_from_in6(&addr, &addrs[0]);
- status = DNS_RESOLVE_SUCCEEDED;
tor_inet_ntop(AF_INET6, &addrs[0], answer_buf, sizeof(answer_buf));
escaped_address = esc_for_log(string_address);
@@ -1595,7 +1592,7 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
escaped_safe_str(answer_buf));
was_wildcarded = 1;
tor_addr_make_unspec(&addr); /* WRONG WRONG ETC XXXXXXXX */
- status = DNS_RESOLVE_FAILED_PERMANENT;
+ result = DNS_ERR_NOTEXIST;
} else {
log_debug(LD_EXIT, "eventdns said that %s resolves to %s",
safe_str(escaped_address),
@@ -1605,7 +1602,6 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
} else if (type == DNS_PTR && count) {
char *escaped_address;
hostname = ((char**)addresses)[0];
- status = DNS_RESOLVE_SUCCEEDED;
escaped_address = esc_for_log(string_address);
log_debug(LD_EXIT, "eventdns said that %s resolves to %s",
safe_str(escaped_address),
@@ -1618,9 +1614,6 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
log_warn(LD_BUG, "eventdns returned no addresses or error for %s!",
escaped_safe_str(string_address));
}
- } else {
- if (evdns_err_is_transient(result))
- status = DNS_RESOLVE_FAILED_TRANSIENT;
}
if (was_wildcarded) {
if (is_test_address(string_address)) {