]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't write ControlPorts to disk till after we setuid and make datadir
authorNick Mathewson <nickm@torproject.org>
Wed, 17 Aug 2011 15:22:16 +0000 (11:22 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 17 Aug 2011 15:22:16 +0000 (11:22 -0400)
Fix for bug 3747; bugfix on 0.2.2.26-beta.

changes/bug3747 [new file with mode: 0644]
src/or/config.c
src/or/connection.c

diff --git a/changes/bug3747 b/changes/bug3747
new file mode 100644 (file)
index 0000000..052dab1
--- /dev/null
@@ -0,0 +1,6 @@
+  o Major bugfixes:
+    - Write control ports to disk only after switching UID and
+      creating the data directory. This way, we don't fail when
+      starting up with a nonexistant DataDirectory and a
+      ControlPortWriteToFile setting based on that directory. Fixes
+      bug 3747; bugfix on Tor 0.2.2.26-beta.
\ No newline at end of file
index e0ecab2d41c24874fe9f1faac5ebac289f775456..7202ea254c3e65ae762fa251945504e4b5b08779 100644 (file)
@@ -1034,6 +1034,9 @@ options_act_reversible(or_options_t *old_options, char **msg)
     /* No need to roll back, since you can't change the value. */
   }
 
+  /* Write control ports to disk as appropriate */
+  control_ports_write_to_file();
+
  if (directory_caches_v2_dir_info(options)) {
     size_t len = strlen(options->DataDirectory)+32;
     char *fn = tor_malloc(len);
index c791309d686c58e6fac3796172da46c2ac032550..2049f4240cb324533d55166b0e0793503c402d22 100644 (file)
@@ -1061,9 +1061,6 @@ connection_create_listener(const struct sockaddr *listensockaddr,
          "%s listening on port %u.",
          conn_type_to_string(type), gotPort);
 
-  if (type == CONN_TYPE_CONTROL_LISTENER)
-    control_ports_write_to_file();
-
   conn->state = LISTENER_STATE_READY;
   if (start_reading) {
     connection_start_reading(conn);