[or-cvs] Bugfix: If we setconf our ORPort to 0, we continued to list...

arma at seul.org arma at seul.org
Wed May 3 18:26:05 UTC 2006


Update of /home/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/tor-011x/tor/src/or

Modified Files:
      Tag: tor-0_1_1-patches
	connection.c 
Log Message:
Bugfix: If we setconf our ORPort to 0, we continued to listen on the
old ORPort and receive connections.


Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.449
retrieving revision 1.449.2.1
diff -u -p -d -r1.449 -r1.449.2.1
--- connection.c	1 Apr 2006 10:22:57 -0000	1.449
+++ connection.c	3 May 2006 18:26:03 -0000	1.449.2.1
@@ -855,7 +855,8 @@ static int
 retry_listeners(int type, config_line_t *cfg,
                 int port_option, const char *default_addr, int force,
                 smartlist_t *replaced_conns,
-                smartlist_t *new_conns)
+                smartlist_t *new_conns,
+                int never_open_conns)
 {
   smartlist_t *launch = smartlist_create();
   int free_launch_elts = 1;
@@ -935,17 +936,19 @@ retry_listeners(int type, config_line_t 
 
   /* Now open all the listeners that are configured but not opened. */
   i = 0;
-  SMARTLIST_FOREACH(launch, config_line_t *, cfg,
-    {
-      conn = connection_create_listener(cfg->value, (uint16_t) port_option,
-                                        type);
-      if (!conn) {
-        i = -1;
-      } else {
-        if (new_conns)
-          smartlist_add(new_conns, conn);
-      }
-  });
+  if (!never_open_conns) {
+    SMARTLIST_FOREACH(launch, config_line_t *, cfg,
+      {
+        conn = connection_create_listener(cfg->value, (uint16_t) port_option,
+                                          type);
+        if (!conn) {
+          i = -1;
+        } else {
+          if (new_conns)
+            smartlist_add(new_conns, conn);
+        }
+    });
+  }
 
   if (free_launch_elts) {
     SMARTLIST_FOREACH(launch, config_line_t *, cfg,
@@ -970,23 +973,22 @@ retry_all_listeners(int force, smartlist
 {
   or_options_t *options = get_options();
 
-  if (server_mode(options) &&
-      retry_listeners(CONN_TYPE_OR_LISTENER, options->ORListenAddress,
+  if (retry_listeners(CONN_TYPE_OR_LISTENER, options->ORListenAddress,
                       options->ORPort, "0.0.0.0", force,
-                      replaced_conns, new_conns)<0)
+                      replaced_conns, new_conns, options->ClientOnly)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_DIR_LISTENER, options->DirListenAddress,
                       options->DirPort, "0.0.0.0", force,
-                      replaced_conns, new_conns)<0)
+                      replaced_conns, new_conns, 0)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_AP_LISTENER, options->SocksListenAddress,
                       options->SocksPort, "127.0.0.1", force,
-                      replaced_conns, new_conns)<0)
+                      replaced_conns, new_conns, 0)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_CONTROL_LISTENER,
                       options->ControlListenAddress,
                       options->ControlPort, "127.0.0.1", force,
-                      replaced_conns, new_conns)<0)
+                      replaced_conns, new_conns, 0)<0)
     return -1;
 
   return 0;



More information about the tor-commits mailing list