[tor-commits] [tor/master] config: Parse ports at the start of options_validate()

nickm at torproject.org nickm at torproject.org
Tue May 9 14:42:12 UTC 2017


commit b867295ffd75c4ab930a8e59a1302ffd2b289bc7
Author: David Goulet <dgoulet at torproject.org>
Date:   Tue Apr 25 15:14:14 2017 -0400

    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 at torproject.org>
---
 src/or/config.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index c8b6e5b..1b40561 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -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;
 





More information about the tor-commits mailing list