diff options
author | Andrea Shepard <andrea@torproject.org> | 2013-05-31 15:35:51 -0700 |
---|---|---|
committer | Andrea Shepard <andrea@torproject.org> | 2013-05-31 15:35:51 -0700 |
commit | ce147a2a9a0e399943362062b1fbccecac36aa99 (patch) | |
tree | 494073f29f107f62878cd7623945996805111651 /src/or/dnsserv.c | |
parent | 30c06c187a0b649bd2d30edc0b16e2376f74ad9a (diff) | |
download | tor-ce147a2a9a0e399943362062b1fbccecac36aa99.tar.gz tor-ce147a2a9a0e399943362062b1fbccecac36aa99.zip |
When launching a resolve request on behalf of an AF_UNIX control, omit the address field of the new entry connection. Fixes bug 8639.
Diffstat (limited to 'src/or/dnsserv.c')
-rw-r--r-- | src/or/dnsserv.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c index a1275cf2b3..ebff7b524c 100644 --- a/src/or/dnsserv.c +++ b/src/or/dnsserv.c @@ -183,8 +183,23 @@ dnsserv_launch_request(const char *name, int reverse, conn->base_.state = AP_CONN_STATE_RESOLVE_WAIT; tor_addr_copy(&TO_CONN(conn)->addr, &control_conn->base_.addr); +#ifdef AF_UNIX + /* + * The control connection can be AF_UNIX and if so tor_dup_addr will + * unhelpfully say "<unknown address type>"; say "(Tor_internal)" + * instead. + */ + if (control_conn->base_.socket_family == AF_UNIX) { + TO_CONN(conn)->port = 0; + TO_CONN(conn)->address = tor_strdup("(Tor_internal)"); + } else { + TO_CONN(conn)->port = control_conn->base_.port; + TO_CONN(conn)->address = tor_dup_addr(&control_conn->base_.addr); + } +#else TO_CONN(conn)->port = control_conn->base_.port; TO_CONN(conn)->address = tor_dup_addr(&control_conn->base_.addr); +#endif if (reverse) entry_conn->socks_request->command = SOCKS_COMMAND_RESOLVE_PTR; |