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

[or-cvs] r9501: Implement an --ignore-missing-torrc option (in tor/trunk: . src/or)



Author: nickm
Date: 2007-02-06 13:36:21 -0500 (Tue, 06 Feb 2007)
New Revision: 9501

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/config.c
Log:
 r11666@catbus:  nickm | 2007-02-06 13:17:24 -0500
 Implement an --ignore-missing-torrc option



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

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-02-06 16:59:49 UTC (rev 9500)
+++ tor/trunk/ChangeLog	2007-02-06 18:36:21 UTC (rev 9501)
@@ -100,6 +100,10 @@
       create_fast cell if we don't know anything about a router.
     - Allow exit nodes to use nameservers running on ports other than 53.
     - Servers now cache reverse DNS replies.
+    - Add an --ignore-missing-torrc command-line option so that we can
+      get the "use sensible defaults if the configuration file doesn't
+      exist" behavior even when specifying a torrc location on the command
+      line.
 
   o Minor features (controller):
     - Track reasons for OR connection failure; make these reasons

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2007-02-06 16:59:49 UTC (rev 9500)
+++ tor/trunk/src/or/config.c	2007-02-06 18:36:21 UTC (rev 9501)
@@ -1075,7 +1075,8 @@
       i += 2; /* command-line option with argument. ignore them. */
       continue;
     } else if (!strcmp(argv[i],"--list-fingerprint") ||
-               !strcmp(argv[i],"--verify-config")) {
+               !strcmp(argv[i],"--verify-config") ||
+               !strcmp(argv[i],"--ignore-missing-torrc")) {
       i += 1; /* command-line option. ignore it. */
       continue;
     } else if (!strcmp(argv[i],"--nt-service") ||
@@ -2967,6 +2968,7 @@
   char *cf=NULL, *fname=NULL, *errmsg=NULL;
   int i, retval;
   int using_default_torrc;
+  int ignore_missing_torrc;
   static char **backup_argv;
   static int backup_argc;
 
@@ -3004,6 +3006,7 @@
   /* learn config file name */
   fname = NULL;
   using_default_torrc = 1;
+  ignore_missing_torrc = 0;
   newoptions->command = CMD_RUN_TOR;
   for (i = 1; i < argc; ++i) {
     if (i < argc-1 && !strcmp(argv[i],"-f")) {
@@ -3014,6 +3017,8 @@
       fname = tor_strdup(argv[i+1]);
       using_default_torrc = 0;
       ++i;
+    } else if (!strcmp(argv[i],"--ignore-missing-torrc")) {
+      ignore_missing_torrc = 1;
     } else if (!strcmp(argv[i],"--list-fingerprint")) {
       newoptions->command = CMD_LIST_FINGERPRINT;
     } else if (!strcmp(argv[i],"--hash-password")) {
@@ -3053,7 +3058,7 @@
   /* get config lines, assign them */
   if (file_status(fname) != FN_FILE ||
       !(cf = read_file_to_str(fname,0,NULL))) {
-    if (using_default_torrc == 1) {
+    if (using_default_torrc == 1 || ignore_missing_torrc ) {
       log(LOG_NOTICE, LD_CONFIG, "Configuration file \"%s\" not present, "
           "using reasonable defaults.", fname);
       tor_free(fname); /* sets fname to NULL */