config: Parse ports at the start of options_validate()

There was a bug that got exposed with the removal of ORListenAddress. Within
server_mode(), we now only check ORPort_set which is set in parse_ports().

However, options_validate() is using server_mode() at the start to check if we
need to look at the uname but then the ORPort_set is unset at that point
because the port parsing was done just after. This commit fixes that.

Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
David Goulet 2017-04-25 15:14:14 -04:00 committed by Nick Mathewson
parent 7f95ef6e66
commit b867295ffd

View File

@ -2947,6 +2947,10 @@ options_validate(or_options_t *old_options, or_options_t *options,
tor_assert(msg);
*msg = NULL;
if (parse_ports(options, 1, msg, &n_ports,
&world_writable_control_socket) < 0)
return -1;
/* Set UseEntryGuards from the configured value, before we check it below.
* We change UseEntryGuards when it's incompatible with other options,
* but leave UseEntryGuards_option with the original value.
@ -2965,10 +2969,6 @@ options_validate(or_options_t *old_options, or_options_t *options,
"for details.", uname);
}
if (parse_ports(options, 1, msg, &n_ports,
&world_writable_control_socket) < 0)
return -1;
if (parse_outbound_addresses(options, 1, msg) < 0)
return -1;