diff options
author | rl1987 <rl1987@sdf.lonestar.org> | 2013-11-03 18:53:41 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-11-07 14:26:05 -0500 |
commit | 86cfc64d4565187250c8b92d25c24a1c5a0bec0d (patch) | |
tree | bcb364729cf3a57a1edbe57d2bb2f23511248b12 | |
parent | 12dc55f4878d16bfc3fb6789b31494d47df7ccec (diff) | |
download | tor-86cfc64d4565187250c8b92d25c24a1c5a0bec0d.tar tor-86cfc64d4565187250c8b92d25c24a1c5a0bec0d.tar.gz |
Implementing --allow-missing-torrc CLI option.
-rw-r--r-- | changes/ticket10060 | 6 | ||||
-rw-r--r-- | doc/tor.1.txt | 4 | ||||
-rw-r--r-- | src/or/config.c | 10 |
3 files changed, 18 insertions, 2 deletions
diff --git a/changes/ticket10060 b/changes/ticket10060 new file mode 100644 index 000000000..6ad0feb04 --- /dev/null +++ b/changes/ticket10060 @@ -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. + diff --git a/doc/tor.1.txt b/doc/tor.1.txt index 86928718a..82f4e3376 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -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 diff --git a/src/or/config.c b/src/or/config.c index 5fc32153e..57d6dcdc0 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -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, |