diff --git a/client/client_state.C b/client/client_state.C index 1e71fa3472..7e41b8e8d9 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -71,9 +71,12 @@ CLIENT_STATE::CLIENT_STATE() { max_bytes = 0; minimize = false; user_idle = true; - use_proxy = false; - proxy_server_name[0] = 0; + use_http_proxy = false; + use_socks_proxy = false; + strcpy(proxy_server_name,""); proxy_server_port = 80; + strcpy(socks_user_name,""); + strcpy(socks_user_passwd,""); suspend_requested = false; #ifdef _WIN32 time_tests_handle = NULL; @@ -498,12 +501,12 @@ int CLIENT_STATE::parse_state_file() { // TODO: handle old client state file if different version } else if (match_tag(buf, "")) { // TODO: handle old client state file if different version - } else if (match_tag(buf, "")) { + } else if (match_tag(buf, "")) { global_prefs.confirm_before_connecting = true; } else if (match_tag(buf, "")) { global_prefs.hangup_if_dialed = true; } else if (match_tag(buf, "")) { - use_proxy = true; + use_http_proxy = true; } else if (parse_str(buf, "", proxy_server_name, sizeof(proxy_server_name))) { } else if (parse_int(buf, "", proxy_server_port)) { } else { @@ -570,13 +573,19 @@ int CLIENT_STATE::write_state_file() { "%s" "%s" "%s" - "%s\n" - "%d\n", - use_proxy?"\n":"", - global_prefs.confirm_before_connecting?"\n":"", + "%s" + "%s\n" + "%d\n" + "%s\n" + "%s\n", + use_http_proxy?"\n":"", + use_socks_proxy?"\n":"", + global_prefs.confirm_before_connecting?"\n":"", global_prefs.hangup_if_dialed?"\n":"", proxy_server_name, - proxy_server_port + proxy_server_port, + socks_user_name, + socks_user_passwd ); fprintf(f, "\n"); fclose(f); @@ -992,7 +1001,6 @@ bool CLIENT_STATE::update_results() { // void CLIENT_STATE::parse_cmdline(int argc, char** argv) { int i; - char *p, temp[256]; for (i=1; i 0) { - use_proxy = true; + use_http_proxy = true; parse_url(p, proxy_server_name, proxy_server_port, temp); } } + + if ((p = getenv("SOCKS_SERVER"))) { + if (strlen(p) > 0) { + use_socks_proxy = true; + parse_url(p, proxy_server_name, proxy_server_port, temp); + } + } + + if ((p = getenv("SOCKS_USER"))) { + strcpy(socks_user_name, p); + } + + if ((p = getenv("SOCKS_PASSWD"))) { + strcpy(socks_user_name, p); + } } // Returns true if the core client should exit diff --git a/client/client_state.h b/client/client_state.h index 29f9943fd4..a9648f7d95 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -63,6 +63,7 @@ public: int exit(); bool do_something(); void parse_cmdline(int argc, char** argv); + void parse_env_vars(); bool time_to_exit(); bool run_time_tests(); int time_tests(); @@ -81,9 +82,12 @@ public: bool minimize; // put client in the background after it's started up bool user_idle; bool suspend_requested; - bool use_proxy; + bool use_http_proxy; + bool use_socks_proxy; int proxy_server_port; char proxy_server_name[256]; + char socks_user_name[256]; + char socks_user_passwd[256]; private: