From: Nick Mathewson Date: Wed, 1 Nov 2017 17:28:31 +0000 (-0400) Subject: Merge remote-tracking branch 'public/owning_control_fd' X-Git-Tag: tor-0.3.3.1-alpha~272 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cd606d5ad36136cb7e66ac462ea945ceb3a9a7f7;p=thirdparty%2Ftor.git Merge remote-tracking branch 'public/owning_control_fd' --- cd606d5ad36136cb7e66ac462ea945ceb3a9a7f7 diff --cc src/or/config.c index c4d2062c83,acc31c0111..b09603f5c1 --- a/src/or/config.c +++ b/src/or/config.c @@@ -1770,9 -1729,26 +1771,27 @@@ options_act(const or_options_t *old_opt log_warn(LD_BUG, "Previously validated client authorization for " "hidden services could not be added!"); return -1; + // LCOV_EXCL_STOP } + if (running_tor && !old_options && options->OwningControllerFD != -1) { + #ifdef _WIN32 + log_warn(LD_CONFIG, "OwningControllerFD is not supported on Windows. " + "If you neeed it, tell the Tor developers."); + return -1; + #else + const unsigned ctrl_flags = + CC_LOCAL_FD_IS_OWNER | + CC_LOCAL_FD_IS_AUTHENTICATED; + tor_socket_t ctrl_sock = (tor_socket_t)options->OwningControllerFD; + if (control_connection_add_local_fd(ctrl_sock, ctrl_flags) < 0) { + log_warn(LD_CONFIG, "Could not add local controller connection with " + "given FD."); + return -1; + } + #endif + } + /* Load state */ if (! or_state_loaded() && running_tor) { if (or_state_load())