]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Consider hibernation before dropping privs
authorSebastian Hahn <sebastian@torproject.org>
Tue, 11 Oct 2011 00:40:06 +0000 (02:40 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Tue, 11 Oct 2011 00:42:12 +0000 (02:42 +0200)
Without this patch, Tor wasn't sure whether it would be hibernating or
not, so it postponed opening listeners until after the privs had been
dropped. This doesn't work so well for low ports. Bug was introduced in
the fix for bug 2003. Fixes bug 4217, reported by Zax and katmagic.
Thanks!

src/or/config.c

index 2705ba5a16f75a114be6c1c04cf29c4c90992c4c..1304c469f651a5137b008c2038d1e636535d266a 100644 (file)
@@ -1080,6 +1080,9 @@ options_act_reversible(const or_options_t *old_options, char **msg)
     if (parse_client_ports(options, 0, msg, &n_client_ports))
       return -1;
 
+    /* Set the hibernation state appropriately.*/
+    consider_hibernation(time(NULL));
+
     /* Launch the listeners.  (We do this before we setuid, so we can bind to
      * ports under 1024.)  We don't want to rebind if we're hibernating. */
     if (!we_are_hibernating()) {