]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Implementing --allow-missing-torrc CLI option.
authorrl1987 <rl1987@sdf.lonestar.org>
Sun, 3 Nov 2013 16:53:41 +0000 (18:53 +0200)
committerNick Mathewson <nickm@torproject.org>
Thu, 7 Nov 2013 19:26:05 +0000 (14:26 -0500)
changes/ticket10060 [new file with mode: 0644]
doc/tor.1.txt
src/or/config.c

diff --git a/changes/ticket10060 b/changes/ticket10060
new file mode 100644 (file)
index 0000000..6ad0feb
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor features:
+    - Adding --allow-missing-torrc commandline option 
+      that allows Tor to run if configuration file specified
+      by -f is not available, but default torrc is. 
+      Implements ticket 10060.
+
index 86928718ac6067b41b8c79b7b32fbd4669ffb8c6..82f4e33763e28eb8d71f95e8e624abcfaedbf0d9 100644 (file)
@@ -45,6 +45,10 @@ COMMAND-LINE OPTIONS
     options. (Default: $HOME/.torrc, or @CONFDIR@/torrc if that file is not
     found)
 
+[[opt-allow-missing-torrc]] **--allow-missing-torrc**::
+    Do not require that configuration file specified by **-f** exist if 
+    default torrc can be accessed.
+
 [[opt-defaults-torrc]] **--defaults-torrc** __FILE__::
     Specify a file in which to find default values for Tor options.  The
     contents of this file are overridden by those in the regular
index 5fc32153e9006c70306a7d0a9953e7dc690518d3..57d6dcdc0ffefd533a18ebe7fa528d32d17be615 100644 (file)
@@ -1816,6 +1816,7 @@ static const struct {
   int takes_argument;
 } CMDLINE_ONLY_OPTIONS[] = {
   { "-f",                     1 },
+  { "--allow-missing-torrc",  0 },
   { "--defaults-torrc",       1 },
   { "--hash-password",        1 },
   { "--dump-config",          1 },
@@ -4016,8 +4017,13 @@ options_init_from_torrc(int argc, char **argv)
   } else {
     cf_defaults = load_torrc_from_disk(cmdline_only_options, 1);
     cf = load_torrc_from_disk(cmdline_only_options, 0);
-    if (!cf)
-      goto err;
+    if (!cf) {
+      if (config_line_find(cmdline_only_options, "--allow-missing-torrc")) {
+        cf = tor_strdup("");
+      } else {
+        goto err;
+      }
+    }
   }
 
   retval = options_init_from_string(cf_defaults, cf, command, command_arg,