summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-07-25 22:57:07 +0000
committerNick Mathewson <nickm@torproject.org>2007-07-25 22:57:07 +0000
commit7f3e2378b64f07f1bcebf80f7846a6580c29786a (patch)
treeac302f1c9fa0fbe25bce80628e713866bfe2797a
parent025a81fc18428800d60b6a5093628cec5aaa8dad (diff)
downloadtor-7f3e2378b64f07f1bcebf80f7846a6580c29786a.tar.gz
tor-7f3e2378b64f07f1bcebf80f7846a6580c29786a.zip
r13908@catbus: nickm | 2007-07-25 18:55:47 -0400
Patch from Robert Hogan: set conn->dns_server_port correctly so that we can close dns server ports when they change, thus avoiding crashes and dangling references and other sources of unhappiness. svn:r10933
-rw-r--r--ChangeLog2
-rw-r--r--src/or/connection.c1
-rw-r--r--src/or/dnsserv.c3
-rw-r--r--src/or/hibernate.c1
4 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 520695184a..62b52db953 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -76,6 +76,8 @@ Changes in version 0.2.0.3-alpha - 2007-??-??
- Add DNSPort connections to the global connection list, so that we
can time them out correctly. (Bug found by mwenge) [Bugfix on
0.2.0.2-alpha]
+ - Fix a dangling reference that could lead to a crash when DNSPort is
+ changed or closed (Patch from Robert Hogan.) [Bugfix on 0.2.0.2-alpha]
o Minor bugfixes (controller)
- Provide DNS expiry times in GMT, not in local time. For backward
diff --git a/src/or/connection.c b/src/or/connection.c
index 4c555fc460..a0210b931f 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2423,6 +2423,7 @@ connection_is_listener(connection_t *conn)
if (conn->type == CONN_TYPE_OR_LISTENER ||
conn->type == CONN_TYPE_AP_LISTENER ||
conn->type == CONN_TYPE_AP_TRANS_LISTENER ||
+ conn->type == CONN_TYPE_AP_DNS_LISTENER ||
conn->type == CONN_TYPE_AP_NATD_LISTENER ||
conn->type == CONN_TYPE_DIR_LISTENER ||
conn->type == CONN_TYPE_CONTROL_LISTENER)
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index 0bc91ed791..360f722f66 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -255,7 +255,8 @@ dnsserv_configure_listener(connection_t *conn)
tor_assert(conn->s);
tor_assert(conn->type == CONN_TYPE_AP_DNS_LISTENER);
- evdns_add_server_port(conn->s, 0, evdns_server_callback, NULL);
+ conn->dns_server_port = evdns_add_server_port(conn->s, 0,
+ evdns_server_callback, NULL);
}
/** Free the evdns server port for <b>conn</b>, which must be an
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index c6d661fe8e..621e042894 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -771,6 +771,7 @@ hibernate_begin(hibernate_state_t new_state, time_t now)
while ((conn = connection_get_by_type(CONN_TYPE_OR_LISTENER)) ||
(conn = connection_get_by_type(CONN_TYPE_AP_LISTENER)) ||
(conn = connection_get_by_type(CONN_TYPE_AP_TRANS_LISTENER)) ||
+ (conn = connection_get_by_type(CONN_TYPE_AP_DNS_LISTENER)) ||
(conn = connection_get_by_type(CONN_TYPE_AP_NATD_LISTENER)) ||
(conn = connection_get_by_type(CONN_TYPE_DIR_LISTENER))) {
log_info(LD_NET,"Closing listener type %d", conn->type);