[or-cvs] whenever we hupped or did a controller setconf, we were pre...

arma at seul.org arma at seul.org
Sun Dec 11 09:18:27 UTC 2005


Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	config.c 
Log Message:
whenever we hupped or did a controller setconf, we were prepending
another reachableaddresses *:80,*:443 if fascistfirewall was set,
and we were appending another reject *:* regardless.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.461
retrieving revision 1.462
diff -u -d -r1.461 -r1.462
--- config.c	11 Dec 2005 08:59:02 -0000	1.461
+++ config.c	11 Dec 2005 09:18:25 -0000	1.462
@@ -1893,7 +1893,7 @@
                          "LongLivedPorts") < 0)
     result = -1;
 
-  if (options->FascistFirewall) {
+  if (options->FascistFirewall && !options->ReachableAddresses) {
     smartlist_t *instead = smartlist_create();
     config_line_t *new_line = tor_malloc_zero(sizeof(config_line_t));
     new_line->key = tor_strdup("ReachableAddresses");
@@ -1915,7 +1915,6 @@
     new_line->value = smartlist_join_strings(instead,",",0,NULL);
     /* These have been deprecated since 0.1.1.5-alpha-cvs */
     log(LOG_NOTICE, LD_CONFIG, "Converting FascistFirewall and FirewallPorts config options to new format: \"ReachableAddresses %s\"", new_line->value);
-    new_line->next = options->ReachableAddresses;
     options->ReachableAddresses = new_line;
     SMARTLIST_FOREACH(instead, char *, cp, tor_free(cp));
     smartlist_free(instead);
@@ -1924,12 +1923,17 @@
   if (options->ReachableAddresses) {
     /* We need to end with a reject *:*, not an implicit accept *:* */
     config_line_t **linep = &options->ReachableAddresses;
-    while (*linep) {
+    for(;;) {
+      if (!strcmp((*linep)->value, "reject *:*")) /* already there */
+        break;
       linep = &((*linep)->next);
+      if (!*linep) {
+        *linep = tor_malloc_zero(sizeof(config_line_t));
+        (*linep)->key = tor_strdup("ReachableAddresses");
+        (*linep)->value = tor_strdup("reject *:*");
+        break;
+      }
     }
-    *linep = tor_malloc_zero(sizeof(config_line_t));
-    (*linep)->key = tor_strdup("ReachableAddresses");
-    (*linep)->value = tor_strdup("reject *:*");
   }
 
   options->_AllowUnverified = 0;



More information about the tor-commits mailing list