diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-08-09 16:13:03 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-08-09 16:13:03 -0400 |
commit | d993b0448508d910be0c26096fe710b13e8af4e7 (patch) | |
tree | c543322f9a5bb9e06e8bbd31e16f03839a782bb7 /src/or | |
parent | e1fb3b8d65080c9583451085b43c04e2f7adefcb (diff) | |
download | tor-d993b0448508d910be0c26096fe710b13e8af4e7.tar.gz tor-d993b0448508d910be0c26096fe710b13e8af4e7.zip |
Reject attempts to say FooPort and FooPort 0 in the same cfg domain
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/config.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c index 6163599358..639abcdb47 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -5667,6 +5667,7 @@ parse_port_config(smartlist_t *out, const unsigned forbid_nonlocal = flags & CL_PORT_FORBID_NONLOCAL; const unsigned allow_spurious_listenaddr = flags & CL_PORT_ALLOW_EXTRA_LISTENADDR; + int got_zero_port=0, got_nonzero_port=0; /* FooListenAddress is deprecated; let's make it work like it used to work, * though. */ @@ -5919,6 +5920,11 @@ parse_port_config(smartlist_t *out, } SMARTLIST_FOREACH_END(elt); } + if (port) + got_nonzero_port = 1; + else + got_zero_port = 1; + if (out && port) { port_cfg_t *cfg = tor_malloc_zero(sizeof(port_cfg_t)); tor_addr_copy(&cfg->addr, &addr); @@ -5945,6 +5951,13 @@ parse_port_config(smartlist_t *out, warn_nonlocal_client_ports(out, portname); } + if (got_zero_port && got_nonzero_port) { + log_warn(LD_CONFIG, "You specified a nonzero %sPort along with '%sPort 0' " + "in the same configuration. Did you mean to disable %sPort or " + "not?", portname, portname, portname); + goto err; + } + retval = 0; err: SMARTLIST_FOREACH(elts, char *, cp, tor_free(cp)); |