summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-01-10 20:00:20 +0000
committerNick Mathewson <nickm@torproject.org>2006-01-10 20:00:20 +0000
commit7fc62029d4d3d7de526b7aa679b96a7da9824aa2 (patch)
tree0054e39e46b236532cbb9b27f0eb4b100941c6fe /src/or
parente1d1ce3da83a8cb2e4e321e6dd5f03d9e3f847ba (diff)
downloadtor-7fc62029d4d3d7de526b7aa679b96a7da9824aa2.tar.gz
tor-7fc62029d4d3d7de526b7aa679b96a7da9824aa2.zip
Refuse to use RunAsDaemon when torrc is a relative path. Fixes bug 229.
svn:r5767
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 6f0772a45d..aeff69feb0 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1887,6 +1887,11 @@ options_validate(or_options_t *old_options, or_options_t *options)
result = -1;
}
+#ifndef MS_WINDOWS
+ if (options->RunAsDaemon && torrc_fname && path_is_relative(torrc_fname))
+ REJECT("Can't use a relative path to torrc when RunAsDaemon is set.");
+#endif
+
if (options->SocksPort < 0 || options->SocksPort > 65535)
REJECT("SocksPort option out of bounds.");
@@ -2502,6 +2507,9 @@ options_init_from_torrc(int argc, char **argv)
tor_assert(fname);
log(LOG_DEBUG, LD_CONFIG, "Opening config file \"%s\"", fname);
+ tor_free(torrc_fname);
+ torrc_fname = fname;
+
/* get config lines, assign them */
if (file_status(fname) != FN_FILE ||
!(cf = read_file_to_str(fname,0))) {
@@ -2543,8 +2551,6 @@ options_init_from_torrc(int argc, char **argv)
if (set_options(newoptions))
goto err; /* frees and replaces old options */
- tor_free(torrc_fname);
- torrc_fname = fname;
return 0;
err:
tor_free(fname);