diff options
author | George Kadianakis <desnacked@riseup.net> | 2012-12-05 18:19:44 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-07-18 14:59:55 -0400 |
commit | d303228ecae1d4c5d9a242b12a4546366544a170 (patch) | |
tree | e0e1e5dcd39ec95cea27dc82cc95aac4e04a6005 /src/or/transports.c | |
parent | ba30d635c5efbbb6a9455925720196b9d56163f6 (diff) | |
download | tor-d303228ecae1d4c5d9a242b12a4546366544a170.tar.gz tor-d303228ecae1d4c5d9a242b12a4546366544a170.zip |
Create the Extended ORPort authentication cookie file.
Diffstat (limited to 'src/or/transports.c')
-rw-r--r-- | src/or/transports.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/or/transports.c b/src/or/transports.c index 15faa98d40..877dc0c335 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -96,6 +96,7 @@ #include "router.h" #include "statefile.h" #include "entrynodes.h" +#include "connection_or.h" static process_environment_t * create_managed_proxy_environment(const managed_proxy_t *mp); @@ -1194,6 +1195,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 @@ -1257,7 +1260,22 @@ 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) { + 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(); + + 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) { |