diff --git a/config.c b/config.c index e462ec25..7085ffc1 100644 --- a/config.c +++ b/config.c @@ -1295,14 +1295,15 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist, ctrl_settitle(b, "Connection/Proxy", "Options controlling proxy usage"); - s = ctrl_getset(b, "Connection/Proxy", "basics", "Proxy basics"); - ctrl_radiobuttons(s, "Proxy type:", 't', 4, + s = ctrl_getset(b, "Connection/Proxy", "basics", NULL); + ctrl_radiobuttons(s, "Proxy type:", 't', 3, HELPCTX(proxy_type), dlg_stdradiobutton_handler, I(offsetof(Config, proxy_type)), "None", I(PROXY_NONE), + "SOCKS 4", I(PROXY_SOCKS4), + "SOCKS 5", I(PROXY_SOCKS5), "HTTP", I(PROXY_HTTP), - "SOCKS", I(PROXY_SOCKS), "Telnet", I(PROXY_TELNET), NULL); ctrl_columns(s, 2, 80, 20); @@ -1346,19 +1347,11 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist, I(offsetof(Config,proxy_password)), I(sizeof(((Config *)0)->proxy_password))); c->editbox.password = 1; - - s = ctrl_getset(b, "Connection/Proxy", "misc", - "Miscellaneous proxy settings"); ctrl_editbox(s, "Telnet command", 'm', 100, HELPCTX(proxy_command), dlg_stdeditbox_handler, I(offsetof(Config,proxy_telnet_command)), I(sizeof(((Config *)0)->proxy_telnet_command))); - ctrl_radiobuttons(s, "SOCKS Version", 'v', 2, - HELPCTX(proxy_socksver), - dlg_stdradiobutton_handler, - I(offsetof(Config, proxy_socks_version)), - "Version 5", I(5), "Version 4", I(4), NULL); } /* diff --git a/doc/config.but b/doc/config.but index e4fd8192..3850656d 100644 --- a/doc/config.but +++ b/doc/config.but @@ -1,4 +1,4 @@ -\versionid $Id: config.but,v 1.63 2003/04/26 13:22:25 simon Exp $ +\versionid $Id: config.but,v 1.64 2003/05/07 12:07:23 simon Exp $ \C{config} Configuring PuTTY @@ -1457,8 +1457,8 @@ connection. web server supporting the HTTP \cw{CONNECT} command, as documented in \W{http://www.ietf.org/rfc/rfc2817.txt}{RFC 2817}. -\b Selecting \q{SOCKS} allows you to proxy your connections through -a SOCKS server. +\b Selecting \q{SOCKS 4} or \q{SOCKS 5} allows you to proxy your +connections through a SOCKS server. \b Many firewalls implement a less formal type of proxy in which a user can make a Telnet connection directly to the firewall machine @@ -1587,15 +1587,6 @@ port. Note that if you do not include the \c{%user} or \c{%pass} tokens in the Telnet command, then the \q{Username} and \q{Password} configuration fields will be ignored. -\S{config-proxy-socksver} Selecting the version of the SOCKS protocol - -\cfg{winhelp-topic}{proxy.socksver} - -SOCKS servers exist in two versions: version 5 -(\W{http://www.ietf.org/rfc/rfc1928.txt}{RFC 1928}) and the earlier -version 4. The \q{SOCKS Version} radio buttons allow you to select -which one to use, if you have selected the SOCKS proxy type. - \H{config-telnet} The Telnet panel The Telnet panel allows you to configure options that only apply to diff --git a/proxy.c b/proxy.c index 59f2abb7..11054df7 100644 --- a/proxy.c +++ b/proxy.c @@ -16,7 +16,9 @@ #define do_proxy_dns(cfg) \ (cfg->proxy_dns == FORCE_ON || \ - (cfg->proxy_dns == AUTO && cfg->proxy_type != PROXY_SOCKS)) + (cfg->proxy_dns == AUTO && \ + cfg->proxy_type != PROXY_SOCKS4 && \ + cfg->proxy_type != PROXY_SOCKS5)) /* * Call this when proxy negotiation is complete, so that this @@ -410,11 +412,10 @@ Socket new_connection(SockAddr addr, char *hostname, if (cfg->proxy_type == PROXY_HTTP) { ret->negotiate = proxy_http_negotiate; - } else if (cfg->proxy_type == PROXY_SOCKS) { - if (cfg->proxy_socks_version == 4) - ret->negotiate = proxy_socks4_negotiate; - else - ret->negotiate = proxy_socks5_negotiate; + } else if (cfg->proxy_type == PROXY_SOCKS4) { + ret->negotiate = proxy_socks4_negotiate; + } else if (cfg->proxy_type == PROXY_SOCKS5) { + ret->negotiate = proxy_socks5_negotiate; } else if (cfg->proxy_type == PROXY_TELNET) { ret->negotiate = proxy_telnet_negotiate; } else { diff --git a/putty.h b/putty.h index 1a02dbca..6d5a0a21 100644 --- a/putty.h +++ b/putty.h @@ -224,7 +224,8 @@ enum { /* * Proxy types. */ - PROXY_NONE, PROXY_HTTP, PROXY_SOCKS, PROXY_TELNET, PROXY_CMD + PROXY_NONE, PROXY_SOCKS4, PROXY_SOCKS5, + PROXY_HTTP, PROXY_TELNET, PROXY_CMD }; enum { @@ -338,7 +339,6 @@ struct config_tag { char proxy_username[32]; char proxy_password[32]; char proxy_telnet_command[512]; - int proxy_socks_version; /* SSH options */ char remote_cmd[512]; char remote_cmd2[512]; /* fallback if the first fails diff --git a/settings.c b/settings.c index 1152926c..216a3eeb 100644 --- a/settings.c +++ b/settings.c @@ -188,13 +188,12 @@ void save_open_settings(void *sesskey, int do_host, Config *cfg) write_setting_s(sesskey, "ProxyExcludeList", cfg->proxy_exclude_list); write_setting_i(sesskey, "ProxyDNS", (cfg->proxy_dns+2)%3); write_setting_i(sesskey, "ProxyLocalhost", cfg->even_proxy_localhost); - write_setting_i(sesskey, "ProxyType", cfg->proxy_type); + write_setting_i(sesskey, "ProxyMethod", cfg->proxy_type); write_setting_s(sesskey, "ProxyHost", cfg->proxy_host); write_setting_i(sesskey, "ProxyPort", cfg->proxy_port); write_setting_s(sesskey, "ProxyUsername", cfg->proxy_username); write_setting_s(sesskey, "ProxyPassword", cfg->proxy_password); write_setting_s(sesskey, "ProxyTelnetCommand", cfg->proxy_telnet_command); - write_setting_i(sesskey, "ProxySOCKSVersion", cfg->proxy_socks_version); { char buf[2 * sizeof(cfg->environmt)], *p, *q; @@ -414,7 +413,26 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg) sizeof(cfg->proxy_exclude_list)); gppi(sesskey, "ProxyDNS", 1, &i); cfg->proxy_dns = (i+1)%3; gppi(sesskey, "ProxyLocalhost", 0, &cfg->even_proxy_localhost); - gppi(sesskey, "ProxyType", PROXY_NONE, &cfg->proxy_type); + gppi(sesskey, "ProxyMethod", -1, &cfg->proxy_type); + if (cfg->proxy_type == -1) { + int i; + gppi(sesskey, "ProxyType", -1, &i); + if (i == 0) + cfg->proxy_type = PROXY_NONE; + else if (i == 1) + cfg->proxy_type = PROXY_HTTP; + else if (i == 3) + cfg->proxy_type = PROXY_TELNET; + else if (i == 4) + cfg->proxy_type = PROXY_CMD; + else { + gppi(sesskey, "ProxySOCKSVersion", 5, &i); + if (i == 5) + cfg->proxy_type = PROXY_SOCKS5; + else + cfg->proxy_type = PROXY_SOCKS4; + } + } gpps(sesskey, "ProxyHost", "proxy", cfg->proxy_host, sizeof(cfg->proxy_host)); gppi(sesskey, "ProxyPort", 80, &cfg->proxy_port); @@ -424,7 +442,6 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg) sizeof(cfg->proxy_password)); gpps(sesskey, "ProxyTelnetCommand", "connect %host %port\\n", cfg->proxy_telnet_command, sizeof(cfg->proxy_telnet_command)); - gppi(sesskey, "ProxySOCKSVersion", 5, &cfg->proxy_socks_version); { char buf[2 * sizeof(cfg->environmt)], *p, *q; diff --git a/unix/uxcfg.c b/unix/uxcfg.c index 1bf58b79..8d8d65eb 100644 --- a/unix/uxcfg.c +++ b/unix/uxcfg.c @@ -130,7 +130,7 @@ void unix_setup_config_box(struct controlbox *b, int midsession, void *win) * Unix supports a local-command proxy. This also means we must * adjust the text on the `Telnet command' control. */ - s = ctrl_getset(b, "Connection/Proxy", "basics", "Proxy basics"); + s = ctrl_getset(b, "Connection/Proxy", "basics", NULL); { int i; for (i = 0; i < s->ncontrols; i++) { @@ -139,7 +139,6 @@ void unix_setup_config_box(struct controlbox *b, int midsession, void *win) c->generic.context.i == offsetof(Config, proxy_type)) { assert(c->generic.handler == dlg_stdradiobutton_handler); c->radio.nbuttons++; - c->radio.ncolumns++; c->radio.buttons = sresize(c->radio.buttons, c->radio.nbuttons, char *); c->radio.buttons[c->radio.nbuttons-1] = @@ -150,11 +149,7 @@ void unix_setup_config_box(struct controlbox *b, int midsession, void *win) break; } } - } - s = ctrl_getset(b, "Connection/Proxy", "misc", - "Miscellaneous proxy settings"); - { - int i; + for (i = 0; i < s->ncontrols; i++) { c = s->ctrls[i]; if (c->generic.type == CTRL_EDITBOX &&