summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/or/config.c4
-rw-r--r--src/or/dns.c14
3 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index cfc9857bac..cb70303812 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,8 @@ Changes in version 0.1.2.2-alpha - 2006-??-??
algorithm from O(n^2) to O(n).
- Make the common memory allocation path faster on machines where
malloc(0) returns a pointer.
+ - Fix a debug log message in eventdns to say "X resolved to Y"
+ instead of "X resolved to X".
Changes in version 0.1.2.1-alpha - 2006-08-27
o Major features:
diff --git a/src/or/config.c b/src/or/config.c
index f81a3e1e82..3fc5f46c09 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -520,7 +520,9 @@ safe_str(const char *address)
return address;
}
-/** Equivalent to escaped(safe_str(address)) */
+/** Equivalent to escaped(safe_str(address)). See reentrancy node on
+ * escaped(): don't use this outside the main thread, or twice in the same
+ * log statement. */
const char *
escaped_safe_str(const char *address)
{
diff --git a/src/or/dns.c b/src/or/dns.c
index 03ed0c03f4..f2ebc2e481 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -1464,20 +1464,26 @@ eventdns_callback(int result, char type, int count, int ttl, void *addresses,
if (type == DNS_IPv4_A && count) {
char answer_buf[INET_NTOA_BUF_LEN+1];
struct in_addr in;
+ char *escaped_address;
uint32_t *addrs = addresses;
in.s_addr = addrs[0];
addr = ntohl(addrs[0]);
status = DNS_RESOLVE_SUCCEEDED;
tor_inet_ntoa(&in, answer_buf, sizeof(answer_buf));
+ escaped_address = esc_for_log(string_address);
log_debug(LD_EXIT, "eventdns said that %s resolves to %s",
- escaped_safe_str(string_address),
- escaped_safe_str(answer_buf)); // XXXX not ok.
+ safe_str(escaped_address),
+ escaped_safe_str(answer_buf));
+ tor_free(escaped_address);
} else if (type == DNS_PTR && count) {
+ char *escaped_address;
is_reverse = 1;
hostname = ((char**)addresses)[0];
+ escaped_address = esc_for_log(string_address);
log_debug(LD_EXIT, "eventdns said that %s resolves to %s",
- escaped_safe_str(string_address),
- escaped_safe_str(hostname)); // XXXX not ok.
+ safe_str(escaped_address),
+ escaped_safe_str(hostname));
+ tor_free(escaped_address);
} else if (count) {
log_warn(LD_EXIT, "eventdns returned only non-IPv4 answers for %s.",
escaped_safe_str(string_address));