[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10933: Patch from Robert Hogan: set conn->dns_server_port correctly (in tor/trunk: . src/or)



Author: nickm
Date: 2007-07-25 18:57:07 -0400 (Wed, 25 Jul 2007)
New Revision: 10933

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/dnsserv.c
   tor/trunk/src/or/hibernate.c
Log:
 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.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r13908] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-07-25 22:57:02 UTC (rev 10932)
+++ tor/trunk/ChangeLog	2007-07-25 22:57:07 UTC (rev 10933)
@@ -76,6 +76,8 @@
     - 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

Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2007-07-25 22:57:02 UTC (rev 10932)
+++ tor/trunk/src/or/connection.c	2007-07-25 22:57:07 UTC (rev 10933)
@@ -2423,6 +2423,7 @@
   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)

Modified: tor/trunk/src/or/dnsserv.c
===================================================================
--- tor/trunk/src/or/dnsserv.c	2007-07-25 22:57:02 UTC (rev 10932)
+++ tor/trunk/src/or/dnsserv.c	2007-07-25 22:57:07 UTC (rev 10933)
@@ -255,7 +255,8 @@
   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

Modified: tor/trunk/src/or/hibernate.c
===================================================================
--- tor/trunk/src/or/hibernate.c	2007-07-25 22:57:02 UTC (rev 10932)
+++ tor/trunk/src/or/hibernate.c	2007-07-25 22:57:07 UTC (rev 10933)
@@ -771,6 +771,7 @@
   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);