diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-08-15 12:04:56 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-08-15 12:04:56 -0400 |
commit | 74262f157178071ad1bce8e70aae79dc01f3ba5d (patch) | |
tree | b1101d4cf3fed95575c9cfc6e3af4452c6d2a8fe /src/or/transports.c | |
parent | 4ab1012b0f5c328f9b70146867e9a2628d06c072 (diff) | |
parent | c5269a59b011c8e961c7e88185b84e78af33d904 (diff) | |
download | tor-74262f157178071ad1bce8e70aae79dc01f3ba5d.tar.gz tor-74262f157178071ad1bce8e70aae79dc01f3ba5d.zip |
Merge branch 'bug5040_4773_rebase_3'
Diffstat (limited to 'src/or/transports.c')
-rw-r--r-- | src/or/transports.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/or/transports.c b/src/or/transports.c index 62cc1a864f..f6bbbe81c5 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -96,6 +96,8 @@ #include "router.h" #include "statefile.h" #include "entrynodes.h" +#include "connection_or.h" +#include "ext_orport.h" static process_environment_t * create_managed_proxy_environment(const managed_proxy_t *mp); @@ -1198,6 +1200,8 @@ get_bindaddr_for_server_proxy(const managed_proxy_t *mp) static process_environment_t * create_managed_proxy_environment(const managed_proxy_t *mp) { + const or_options_t *options = get_options(); + /* Environment variables to be added to or set in mp's environment. */ smartlist_t *envs = smartlist_new(); /* XXXX The next time someone touches this code, shorten the name of @@ -1261,7 +1265,23 @@ create_managed_proxy_environment(const managed_proxy_t *mp) * (If we remove this line entirely, some joker will stick this * variable in Tor's environment and crash PTs that try to parse * it even when not run in server mode.) */ - smartlist_add(envs, tor_strdup("TOR_PT_EXTENDED_SERVER_PORT=")); + + if (options->ExtORPort_lines) { + char *ext_or_addrport_tmp = + get_first_listener_addrport_string(CONN_TYPE_EXT_OR_LISTENER); + char *cookie_file_loc = get_ext_or_auth_cookie_file_name(); + + smartlist_add_asprintf(envs, "TOR_PT_EXTENDED_SERVER_PORT=%s", + ext_or_addrport_tmp); + smartlist_add_asprintf(envs, "TOR_PT_AUTH_COOKIE_FILE=%s", + cookie_file_loc); + + tor_free(ext_or_addrport_tmp); + tor_free(cookie_file_loc); + + } else { + smartlist_add_asprintf(envs, "TOR_PT_EXTENDED_SERVER_PORT="); + } } SMARTLIST_FOREACH_BEGIN(envs, const char *, env_var) { |