[or-cvs] Leave options->DirServers alone -- if the user didn"t speci...

arma at seul.org arma at seul.org
Fri Nov 18 02:47:11 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 or.h routerlist.c 
Log Message:
Leave options->DirServers alone -- if the user didn't specify any,
just add the default ones directly to the trusted dirserver list.
This fixes a bug where people running controllers would setconf or
the equivalent, and Tor would start yelling at them about setting
their own DirServer lines.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.447
retrieving revision 1.448
diff -u -d -r1.447 -r1.448
--- config.c	16 Nov 2005 23:37:35 -0000	1.447
+++ config.c	18 Nov 2005 02:47:08 -0000	1.448
@@ -430,6 +430,19 @@
     return address;
 }
 
+/** Add the default directory servers directly into the trusted dir list. */
+static void
+add_default_trusted_dirservers(void)
+{
+  const char *dirservers[] = {
+"moria1 v1 18.244.0.188:9031 FFCB 46DB 1339 DA84 674C 70D7 CB58 6434 C437 0441",
+"moria2 v1 18.244.0.114:80 719B E45D E224 B607 C537 07D0 E214 3E2D 423E 74CF",
+"tor26 v1 86.59.21.38:80 847B 1F85 0344 D787 6491 A548 92F9 0493 4E4E B85D" };
+  parse_dir_server_line(dirservers[0], 0);
+  parse_dir_server_line(dirservers[1], 0);
+  parse_dir_server_line(dirservers[2], 0);
+}
+
 /** Fetch the active option list, and take actions based on it. All of the
  * things we do should survive being done repeatedly.  If present,
  * <b>old_options</b> contains the previous value of the options.
@@ -541,12 +554,16 @@
   int running_tor = options->command == CMD_RUN_TOR;
 
   clear_trusted_dir_servers();
-  for (cl = options->DirServers; cl; cl = cl->next) {
-    if (parse_dir_server_line(cl->value, 0)<0) {
-      err(LD_BUG,
-          "Bug: Previously validated DirServer line could not be added!");
-      return -1;
+  if (options->DirServers) {
+    for (cl = options->DirServers; cl; cl = cl->next) {
+      if (parse_dir_server_line(cl->value, 0)<0) {
+        err(LD_BUG,
+            "Bug: Previously validated DirServer line could not be added!");
+        return -1;
+      }
     }
+  } else {
+    add_default_trusted_dirservers();
   }
 
   if (running_tor && rend_config_services(options, 0)<0) {
@@ -1343,20 +1360,6 @@
   }
 }
 
-/** Set <b>options</b>-&gt;DirServers to contain the default directory
- * servers. */
-static void
-add_default_trusted_dirservers(or_options_t *options)
-{
-  config_line_append(&options->DirServers, "DirServer",
-     "moria1 v1 18.244.0.188:9031 FFCB 46DB 1339 DA84 674C 70D7 CB58 6434 C437 0441");
-  config_line_append(&options->DirServers, "DirServer",
-     "moria2 v1 18.244.0.114:80 719B E45D E224 B607 C537 07D0 E214 3E2D 423E 74CF");
-  config_line_append(&options->DirServers, "DirServer",
-     "tor26 v1 86.59.21.38:80 847B 1F85 0344 D787 6491 A548 92F9 0493 4E4E B85D");
-//  "tor.noreply.org:9030 847B 1F85 0344 D787 6491 A548 92F9 0493 4E4E B85D");
-}
-
 /** Print a usage message for tor. */
 static void
 print_usage(void)
@@ -2076,9 +2079,7 @@
       result = -1;
   }
 
-  if (!options->DirServers) {
-    add_default_trusted_dirservers(options);
-  } else {
+  if (options->DirServers) {
     COMPLAIN("You have used DirServer to specify directory authorities in your configuration.  This is potentially dangerous: it can make you look different from all other Tor users, and hurt your anonymity.  Even if you've specified the same authorities as Tor uses by default, the defaults could change in the future.  Be sure you know what you're doing.");
     for (cl = options->DirServers; cl; cl = cl->next) {
       if (parse_dir_server_line(cl->value, 1)<0)

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.734
retrieving revision 1.735
diff -u -d -r1.734 -r1.735
--- or.h	17 Nov 2005 01:17:53 -0000	1.734
+++ or.h	18 Nov 2005 02:47:09 -0000	1.735
@@ -1142,7 +1142,7 @@
   struct config_line_t *next;
 } config_line_t;
 
-/** Configuration options for a Tor process */
+/** Configuration options for a Tor process. */
 typedef struct {
   uint32_t _magic;
 
@@ -1154,10 +1154,10 @@
   const char *command_arg; /**< Argument for command-line option. */
 
   config_line_t *OldLogOptions; /**< List of configuration lines
-                                        * for logfiles, old style. */
+                                 * for logfiles, old style. */
 
   config_line_t *Logs; /**< New-style list of configuration lines
-                               * for logs */
+                        * for logs */
 
   char *DebugLogFile; /**< Where to send verbose log messages. */
   char *DataDirectory; /**< OR only: where to store long-term data. */

Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.369
retrieving revision 1.370
diff -u -d -r1.369 -r1.370
--- routerlist.c	17 Nov 2005 22:23:18 -0000	1.369
+++ routerlist.c	18 Nov 2005 02:47:09 -0000	1.370
@@ -2413,7 +2413,7 @@
     }
   } else {
     if (tor_lookup_hostname(address, &a)) {
-      warn(LD_CONFIG, "Unable to lookup address for directory server at %s",
+      warn(LD_CONFIG, "Unable to lookup address for directory server at '%s'",
            address);
       return;
     }



More information about the tor-commits mailing list