summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-02-06 18:36:21 +0000
committerNick Mathewson <nickm@torproject.org>2007-02-06 18:36:21 +0000
commitf4a1c17e5ab5e4a6596eb34b926d595f966f8f6b (patch)
treed85f0d741ff36aefbb07dbeff7949d1107cc9d6e
parent0c4ab00658cc33e893c4b402ddc81d083338bbd4 (diff)
downloadtor-f4a1c17e5ab5e4a6596eb34b926d595f966f8f6b.tar.gz
tor-f4a1c17e5ab5e4a6596eb34b926d595f966f8f6b.zip
r11666@catbus: nickm | 2007-02-06 13:17:24 -0500
Implement an --ignore-missing-torrc option svn:r9501
-rw-r--r--ChangeLog4
-rw-r--r--src/or/config.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 12918a206d..bcbf527ba4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -100,6 +100,10 @@ Changes in version 0.1.2.7-alpha - 2007-02-06
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
diff --git a/src/or/config.c b/src/or/config.c
index eb6cdaf290..962752cf0b 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1075,7 +1075,8 @@ config_get_commandlines(int argc, char **argv, config_line_t **result)
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 @@ options_init_from_torrc(int argc, char **argv)
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 @@ options_init_from_torrc(int argc, char **argv)
/* 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 @@ options_init_from_torrc(int argc, char **argv)
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 @@ options_init_from_torrc(int argc, char **argv)
/* 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 */