X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/962c69bf918553c1c8f57193168a832242c0db73..5ecd7ad009cc5148c67b9d665f79a64083fae254:/windlg.c diff --git a/windlg.c b/windlg.c index b512b1cd..4a771719 100644 --- a/windlg.c +++ b/windlg.c @@ -27,6 +27,10 @@ static int requested_help; static struct prefslist cipherlist; +extern Config cfg; /* defined in window.c */ + +struct sesslist sesslist; /* exported to window.c */ + #define PRINTER_DISABLED_STRING "None (printing disabled)" void force_normal(HWND hwnd) @@ -140,7 +144,7 @@ static int CALLBACK LogProc(HWND hwnd, UINT msg, memcpy(p, sel_nl, sizeof(sel_nl)); p += sizeof(sel_nl); } - write_aclip(clipdata, size, TRUE); + write_aclip(NULL, clipdata, size, TRUE); sfree(clipdata); } sfree(selitems); @@ -452,6 +456,11 @@ enum { IDCX_ABOUT = IDC_PROXYPORTEDIT, IDC_PROXYEXCLUDESTATIC, IDC_PROXYEXCLUDEEDIT, + IDC_PROXYLOCALHOST, + IDC_PROXYDNSSTATIC, + IDC_PROXYDNSNO, + IDC_PROXYDNSAUTO, + IDC_PROXYDNSYES, IDC_PROXYUSERSTATIC, IDC_PROXYUSEREDIT, IDC_PROXYPASSSTATIC, @@ -509,11 +518,12 @@ enum { IDCX_ABOUT = IDC_CIPHERLIST, IDC_CIPHERUP, IDC_CIPHERDN, - IDC_BUGGYMAC, IDC_SSH2DES, IDC_SSHPROTSTATIC, + IDC_SSHPROT1ONLY, IDC_SSHPROT1, IDC_SSHPROT2, + IDC_SSHPROT2ONLY, IDC_CMDSTATIC, IDC_CMDEDIT, IDC_COMPRESS, @@ -532,6 +542,25 @@ enum { IDCX_ABOUT = IDC_AUTHKI, sshauthpanelend, + sshbugspanelstart, + IDC_TITLE_SSHBUGS, + IDC_BOX_SSHBUGS1, + IDC_BUGS_IGNORE1, + IDC_BUGD_IGNORE1, + IDC_BUGS_PLAINPW1, + IDC_BUGD_PLAINPW1, + IDC_BUGS_RSA1, + IDC_BUGD_RSA1, + IDC_BUGS_HMAC2, + IDC_BUGD_HMAC2, + IDC_BUGS_DERIVEKEY2, + IDC_BUGD_DERIVEKEY2, + IDC_BUGS_RSAPAD2, + IDC_BUGD_RSAPAD2, + IDC_BUGS_DHGEX2, + IDC_BUGD_DHGEX2, + sshbugspanelend, + selectionpanelstart, IDC_TITLE_SELECTION, IDC_BOX_SELECTION1, @@ -593,6 +622,9 @@ enum { IDCX_ABOUT = IDC_X11_FORWARD, IDC_X11_DISPSTATIC, IDC_X11_DISPLAY, + IDC_X11AUTHSTATIC, + IDC_X11MIT, + IDC_X11XDM, IDC_LPORT_ALL, IDC_RPORT_ALL, IDC_PFWDSTATIC, @@ -847,6 +879,39 @@ char *help_context_cmd(int id) case IDC_NODELAY: return "JI(`',`connection.nodelay')"; + case IDC_PROXYTYPESTATIC: + case IDC_PROXYTYPENONE: + case IDC_PROXYTYPEHTTP: + case IDC_PROXYTYPESOCKS: + case IDC_PROXYTYPETELNET: + return "JI(`',`proxy.type')"; + case IDC_PROXYHOSTSTATIC: + case IDC_PROXYHOSTEDIT: + case IDC_PROXYPORTSTATIC: + case IDC_PROXYPORTEDIT: + return "JI(`',`proxy.main')"; + case IDC_PROXYEXCLUDESTATIC: + case IDC_PROXYEXCLUDEEDIT: + case IDC_PROXYLOCALHOST: + return "JI(`',`proxy.exclude')"; + case IDC_PROXYDNSSTATIC: + case IDC_PROXYDNSNO: + case IDC_PROXYDNSAUTO: + case IDC_PROXYDNSYES: + return "JI(`',`proxy.dns')"; + case IDC_PROXYUSERSTATIC: + case IDC_PROXYUSEREDIT: + case IDC_PROXYPASSSTATIC: + case IDC_PROXYPASSEDIT: + return "JI(`',`proxy.auth')"; + case IDC_PROXYTELNETCMDSTATIC: + case IDC_PROXYTELNETCMDEDIT: + return "JI(`',`proxy.command')"; + case IDC_PROXYSOCKSVERSTATIC: + case IDC_PROXYSOCKSVER5: + case IDC_PROXYSOCKSVER4: + return "JI(`',`proxy.socksver')"; + case IDC_TSSTATIC: case IDC_TSEDIT: return "JI(`',`telnet.termspeed')"; @@ -887,11 +952,11 @@ char *help_context_cmd(int id) case IDC_CIPHERDN: case IDC_SSH2DES: return "JI(`',`ssh.ciphers')"; - case IDC_BUGGYMAC: - return "JI(`',`ssh.buggymac')"; case IDC_SSHPROTSTATIC: + case IDC_SSHPROT1ONLY: case IDC_SSHPROT1: case IDC_SSHPROT2: + case IDC_SSHPROT2ONLY: return "JI(`',`ssh.protocol')"; case IDC_CMDSTATIC: case IDC_CMDEDIT: @@ -965,6 +1030,10 @@ char *help_context_cmd(int id) case IDC_X11_DISPSTATIC: case IDC_X11_DISPLAY: return "JI(`',`ssh.tunnels.x11')"; + case IDC_X11AUTHSTATIC: + case IDC_X11MIT: + case IDC_X11XDM: + return "JI(`',`ssh.tunnels.x11auth')"; case IDC_PFWDSTATIC: case IDC_PFWDSTATIC2: case IDC_PFWDREMOVE: @@ -981,6 +1050,28 @@ char *help_context_cmd(int id) case IDC_RPORT_ALL: return "JI(`',`ssh.tunnels.portfwd.localhost')"; + case IDC_BUGS_IGNORE1: + case IDC_BUGD_IGNORE1: + return "JI(`',`ssh.bugs.ignore1')"; + case IDC_BUGS_PLAINPW1: + case IDC_BUGD_PLAINPW1: + return "JI(`',`ssh.bugs.plainpw1')"; + case IDC_BUGS_RSA1: + case IDC_BUGD_RSA1: + return "JI(`',`ssh.bugs.rsa1')"; + case IDC_BUGS_HMAC2: + case IDC_BUGD_HMAC2: + return "JI(`',`ssh.bugs.hmac2')"; + case IDC_BUGS_DERIVEKEY2: + case IDC_BUGD_DERIVEKEY2: + return "JI(`',`ssh.bugs.derivekey2')"; + case IDC_BUGS_RSAPAD2: + case IDC_BUGD_RSAPAD2: + return "JI(`',`ssh.bugs.rsapad2')"; + case IDC_BUGS_DHGEX2: + case IDC_BUGD_DHGEX2: + return "JI(`',`ssh.bugs.dhgex2')"; + default: return NULL; } @@ -1000,9 +1091,9 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) n = SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_GETCOUNT, 0, 0); for (i = n; i-- > 0;) SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_DELETESTRING, i, 0); - for (i = 0; i < nsessions; i++) + for (i = 0; i < sesslist.nsessions; i++) SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_ADDSTRING, - 0, (LPARAM) (sessions[i])); + 0, (LPARAM) (sesslist.sessions[i])); } SetDlgItemInt(hwnd, IDC_PORT, cfg.port, FALSE); CheckRadioButton(hwnd, IDC_PROTRAW, IDC_PROTSSH, @@ -1045,11 +1136,11 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) CheckDlgButton(hwnd, IDC_TELNETKEY, cfg.telnet_keyboard); CheckDlgButton(hwnd, IDC_TELNETRET, cfg.telnet_newline); CheckRadioButton(hwnd, IDC_ECHOBACKEND, IDC_ECHONO, - cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND : - cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO); + cfg.localecho == AUTO ? IDC_ECHOBACKEND : + cfg.localecho == FORCE_ON ? IDC_ECHOYES : IDC_ECHONO); CheckRadioButton(hwnd, IDC_EDITBACKEND, IDC_EDITNO, - cfg.localedit == LD_BACKEND ? IDC_EDITBACKEND : - cfg.localedit == LD_YES ? IDC_EDITYES : IDC_EDITNO); + cfg.localedit == AUTO ? IDC_EDITBACKEND : + cfg.localedit == FORCE_ON ? IDC_EDITYES : IDC_EDITNO); SetDlgItemText(hwnd, IDC_ANSWEREDIT, cfg.answerback); CheckDlgButton(hwnd, IDC_ALWAYSONTOP, cfg.alwaysontop); CheckDlgButton(hwnd, IDC_FULLSCREENONALTENTER, cfg.fullscreenonaltenter); @@ -1085,7 +1176,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) CheckDlgButton(hwnd, IDC_BLINKTEXT, cfg.blinktext); SetDlgItemText(hwnd, IDC_WINEDIT, cfg.wintitle); - CheckDlgButton(hwnd, IDC_WINNAME, cfg.win_name_always); + CheckDlgButton(hwnd, IDC_WINNAME, !cfg.win_name_always); CheckDlgButton(hwnd, IDC_HIDEMOUSE, cfg.hide_mouseptr); CheckDlgButton(hwnd, IDC_SUNKENEDGE, cfg.sunken_edge); SetDlgItemInt(hwnd, IDC_WINBEDIT, cfg.window_border, FALSE); @@ -1101,9 +1192,9 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) cfg.resize_action == RESIZE_EITHER ? IDC_RESIZEEITHER : IDC_RESIZENONE); CheckRadioButton(hwnd, IDC_COEALWAYS, IDC_COENORMAL, - cfg.close_on_exit == COE_NORMAL ? IDC_COENORMAL : + cfg.close_on_exit == AUTO ? IDC_COENORMAL : cfg.close_on_exit == - COE_NEVER ? IDC_COENEVER : IDC_COEALWAYS); + FORCE_OFF ? IDC_COENEVER : IDC_COEALWAYS); CheckDlgButton(hwnd, IDC_CLOSEWARN, cfg.warn_on_close); SetDlgItemText(hwnd, IDC_TTEDIT, cfg.termtype); @@ -1145,12 +1236,13 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username); CheckDlgButton(hwnd, IDC_NOPTY, cfg.nopty); CheckDlgButton(hwnd, IDC_COMPRESS, cfg.compression); - CheckDlgButton(hwnd, IDC_BUGGYMAC, cfg.buggymac); CheckDlgButton(hwnd, IDC_SSH2DES, cfg.ssh2_des_cbc); CheckDlgButton(hwnd, IDC_AGENTFWD, cfg.agentfwd); CheckDlgButton(hwnd, IDC_CHANGEUSER, cfg.change_username); - CheckRadioButton(hwnd, IDC_SSHPROT1, IDC_SSHPROT2, - cfg.sshprot == 1 ? IDC_SSHPROT1 : IDC_SSHPROT2); + CheckRadioButton(hwnd, IDC_SSHPROT1ONLY, IDC_SSHPROT2ONLY, + cfg.sshprot == 1 ? IDC_SSHPROT1 : + cfg.sshprot == 2 ? IDC_SSHPROT2 : + cfg.sshprot == 3 ? IDC_SSHPROT2ONLY : IDC_SSHPROT1ONLY); CheckDlgButton(hwnd, IDC_AUTHTIS, cfg.try_tis_auth); CheckDlgButton(hwnd, IDC_AUTHKI, cfg.try_ki_auth); SetDlgItemText(hwnd, IDC_PKEDIT, cfg.keyfile); @@ -1264,6 +1356,8 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) CheckDlgButton(hwnd, IDC_X11_FORWARD, cfg.x11_forward); SetDlgItemText(hwnd, IDC_X11_DISPLAY, cfg.x11_display); + CheckRadioButton(hwnd, IDC_X11MIT, IDC_X11XDM, + cfg.x11_auth == X11_MIT ? IDC_X11MIT : IDC_X11XDM); CheckDlgButton(hwnd, IDC_LPORT_ALL, cfg.lport_acceptall); CheckDlgButton(hwnd, IDC_RPORT_ALL, cfg.rport_acceptall); @@ -1277,11 +1371,67 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) SetDlgItemText(hwnd, IDC_PROXYHOSTEDIT, cfg.proxy_host); SetDlgItemInt(hwnd, IDC_PROXYPORTEDIT, cfg.proxy_port, FALSE); SetDlgItemText(hwnd, IDC_PROXYEXCLUDEEDIT, cfg.proxy_exclude_list); + CheckDlgButton(hwnd, IDC_PROXYLOCALHOST, cfg.even_proxy_localhost); + CheckRadioButton(hwnd, IDC_PROXYDNSNO, IDC_PROXYDNSYES, + cfg.proxy_dns == FORCE_OFF ? IDC_PROXYDNSNO : + cfg.proxy_dns == FORCE_ON ? IDC_PROXYDNSYES : + IDC_PROXYDNSAUTO); SetDlgItemText(hwnd, IDC_PROXYTELNETCMDEDIT, cfg.proxy_telnet_command); SetDlgItemText(hwnd, IDC_PROXYUSEREDIT, cfg.proxy_username); SetDlgItemText(hwnd, IDC_PROXYPASSEDIT, cfg.proxy_password); CheckRadioButton(hwnd, IDC_PROXYSOCKSVER5, IDC_PROXYSOCKSVER4, cfg.proxy_socks_version == 4 ? IDC_PROXYSOCKSVER4 : IDC_PROXYSOCKSVER5); + + /* SSH bugs config */ + SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, CB_ADDSTRING, 0, (LPARAM)"Auto"); + SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, CB_ADDSTRING, 0, (LPARAM)"Off"); + SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, CB_ADDSTRING, 0, (LPARAM)"On"); + SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, CB_SETCURSEL, + cfg.sshbug_ignore1 == FORCE_ON ? 2 : + cfg.sshbug_ignore1 == FORCE_OFF ? 1 : 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_ADDSTRING, 0, (LPARAM)"Auto"); + SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_ADDSTRING, 0, (LPARAM)"Off"); + SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_ADDSTRING, 0, (LPARAM)"On"); + SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, CB_SETCURSEL, + cfg.sshbug_plainpw1 == FORCE_ON ? 2 : + cfg.sshbug_plainpw1 == FORCE_OFF ? 1 : 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_ADDSTRING, 0, (LPARAM)"Auto"); + SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_ADDSTRING, 0, (LPARAM)"Off"); + SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_ADDSTRING, 0, (LPARAM)"On"); + SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, CB_SETCURSEL, + cfg.sshbug_rsa1 == FORCE_ON ? 2 : + cfg.sshbug_rsa1 == FORCE_OFF ? 1 : 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_ADDSTRING, 0, (LPARAM)"Auto"); + SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_ADDSTRING, 0, (LPARAM)"Off"); + SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_ADDSTRING, 0, (LPARAM)"On"); + SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, CB_SETCURSEL, + cfg.sshbug_hmac2 == FORCE_ON ? 2 : + cfg.sshbug_hmac2 == FORCE_OFF ? 1 : 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_ADDSTRING, 0, (LPARAM)"Auto"); + SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_ADDSTRING, 0, (LPARAM)"Off"); + SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_ADDSTRING, 0, (LPARAM)"On"); + SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, CB_SETCURSEL, + cfg.sshbug_derivekey2 == FORCE_ON ? 2 : + cfg.sshbug_derivekey2 == FORCE_OFF ? 1 : 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_ADDSTRING, 0, (LPARAM)"Auto"); + SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_ADDSTRING, 0, (LPARAM)"Off"); + SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_ADDSTRING, 0, (LPARAM)"On"); + SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, CB_SETCURSEL, + cfg.sshbug_rsapad2 == FORCE_ON ? 2 : + cfg.sshbug_rsapad2 == FORCE_OFF ? 1 : 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_ADDSTRING, 0, (LPARAM)"Auto"); + SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_ADDSTRING, 0, (LPARAM)"Off"); + SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_ADDSTRING, 0, (LPARAM)"On"); + SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, CB_SETCURSEL, + cfg.sshbug_dhgex2 == FORCE_ON ? 2 : + cfg.sshbug_dhgex2 == FORCE_OFF ? 1 : 0, 0); } struct treeview_faff { @@ -1570,7 +1720,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) IDC_BOX_APPEARANCE3); multiedit(&cp, "Window &title:", IDC_WINTITLE, IDC_WINEDIT, 100, NULL); - checkbox(&cp, "Avoid ever using &icon title", IDC_WINNAME); + checkbox(&cp, "Separate window and &icon titles", IDC_WINNAME); endbox(&cp); beginbox(&cp, "Adjust the use of the mouse pointer", IDC_BOX_APPEARANCE4); @@ -1727,7 +1877,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == proxypanelstart) { - /* The Proxy panel. Accelerators used: [acgoh] ntslypeuwmv */ + /* The Proxy panel. Accelerators used: [acgoh] ntslypeuwmvxd */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1745,10 +1895,17 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) multiedit(&cp, "&Exclude Hosts/IPs", IDC_PROXYEXCLUDESTATIC, IDC_PROXYEXCLUDEEDIT, 100, NULL); + checkbox(&cp, "Consider pro&xying local host connections", + IDC_PROXYLOCALHOST); + radioline(&cp, "Do &DNS name lookup at proxy end:", + IDC_PROXYDNSSTATIC, 3, + "No", IDC_PROXYDNSNO, + "Auto", IDC_PROXYDNSAUTO, + "Yes", IDC_PROXYDNSYES, NULL); staticedit(&cp, "&Username", IDC_PROXYUSERSTATIC, IDC_PROXYUSEREDIT, 60); - staticedit(&cp, "Pass&word", IDC_PROXYPASSSTATIC, - IDC_PROXYPASSEDIT, 60); + staticpassedit(&cp, "Pass&word", IDC_PROXYPASSSTATIC, + IDC_PROXYPASSEDIT, 60); endbox(&cp); beginbox(&cp, "Misc. proxy settings", IDC_BOX_PROXY2); multiedit(&cp, @@ -1808,7 +1965,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == sshpanelstart) { - /* The SSH panel. Accelerators used: [acgoh] r pe12i sd */ + /* The SSH panel. Accelerators used: [acgoh] r pel12n sud i */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1823,16 +1980,17 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) checkbox(&cp, "Don't allocate a &pseudo-terminal", IDC_NOPTY); checkbox(&cp, "Enable compr&ession", IDC_COMPRESS); radioline(&cp, "Preferred SSH protocol version:", - IDC_SSHPROTSTATIC, 2, - "&1", IDC_SSHPROT1, "&2", IDC_SSHPROT2, NULL); - checkbox(&cp, "&Imitate SSH 2 MAC bug in commercial <= v2.3.x", - IDC_BUGGYMAC); + IDC_SSHPROTSTATIC, 4, + "1 on&ly", IDC_SSHPROT1ONLY, + "&1", IDC_SSHPROT1, "&2", IDC_SSHPROT2, + "2 o&nly", IDC_SSHPROT2ONLY, NULL); endbox(&cp); beginbox(&cp, "Encryption options", IDC_BOX_SSH3); + /* Adds accelerators: ud */ prefslist(&cipherlist, &cp, "Encryption cipher &selection policy:", IDC_CIPHERSTATIC2, IDC_CIPHERLIST, IDC_CIPHERUP, IDC_CIPHERDN); - checkbox(&cp, "Enable non-standard use of single-&DES in SSH 2", + checkbox(&cp, "Enable non-standard use of s&ingle-DES in SSH 2", IDC_SSH2DES); endbox(&cp); } @@ -1864,8 +2022,35 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } } + if (panel == sshbugspanelstart) { + /* The SSH bugs panel. Accelerators used: [acgoh] isrmepd */ + struct ctlpos cp; + ctlposinit(&cp, hwnd, 80, 3, 13); + if (dlgtype == 0) { + bartitle(&cp, "Workarounds for SSH server bugs", + IDC_TITLE_SSHBUGS); + beginbox(&cp, "Detection of known bugs in SSH servers", + IDC_BOX_SSHBUGS1); + staticddl(&cp, "Chokes on SSH1 &ignore messages", + IDC_BUGS_IGNORE1, IDC_BUGD_IGNORE1, 20); + staticddl(&cp, "Refuses all SSH1 pa&ssword camouflage", + IDC_BUGS_PLAINPW1, IDC_BUGD_PLAINPW1, 20); + staticddl(&cp, "Chokes on SSH1 &RSA authentication", + IDC_BUGS_RSA1, IDC_BUGD_RSA1, 20); + staticddl(&cp, "Miscomputes SSH2 H&MAC keys", + IDC_BUGS_HMAC2, IDC_BUGD_HMAC2, 20); + staticddl(&cp, "Miscomputes SSH2 &encryption keys", + IDC_BUGS_DERIVEKEY2, IDC_BUGD_DERIVEKEY2, 20); + staticddl(&cp, "Requires &padding on SSH2 RSA signatures", + IDC_BUGS_RSAPAD2, IDC_BUGD_RSAPAD2, 20); + staticddl(&cp, "Chokes on &Diffie-Hellman group exchange", + IDC_BUGS_DHGEX2, IDC_BUGD_DHGEX2, 20); + endbox(&cp); + } + } + if (panel == tunnelspanelstart) { - /* The Tunnels panel. Accelerators used: [acgoh] deilmrstxp */ + /* The Tunnels panel. Accelerators used: [acgoh] exu tprsdilm */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1873,8 +2058,12 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) IDC_TITLE_TUNNELS); beginbox(&cp, "X11 forwarding", IDC_BOX_TUNNELS1); checkbox(&cp, "&Enable X11 forwarding", IDC_X11_FORWARD); - multiedit(&cp, "&X display location", IDC_X11_DISPSTATIC, - IDC_X11_DISPLAY, 50, NULL); + staticedit(&cp, "&X display location", IDC_X11_DISPSTATIC, + IDC_X11_DISPLAY, 50); + radioline(&cp, "Remote X11 a&uthentication protocol", + IDC_X11AUTHSTATIC, 2, + "MIT-Magic-Cookie-1", IDC_X11MIT, + "XDM-Authorization-1", IDC_X11XDM, NULL); endbox(&cp); beginbox(&cp, "Port forwarding", IDC_BOX_TUNNELS2); checkbox(&cp, "Local ports accept connections from o&ther hosts", @@ -1887,10 +2076,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) "Add new forwarded port:", IDC_PFWDSTATIC2, "&Source port", IDC_SPORTSTATIC, IDC_SPORTEDIT, "Dest&ination", IDC_DPORTSTATIC, IDC_DPORTEDIT, - "A&dd", IDC_PFWDADD); - bareradioline(&cp, 2, - "&Local", IDC_PFWDLOCAL, - "Re&mote", IDC_PFWDREMOTE, NULL); + "A&dd", IDC_PFWDADD, + "&Local", IDC_PFWDLOCAL, + "Re&mote", IDC_PFWDREMOTE); endbox(&cp); } @@ -1911,11 +2099,11 @@ static int load_selected_session(HWND hwnd) MessageBeep(0); return 0; } - isdef = !strcmp(sessions[n], "Default Settings"); - load_settings(sessions[n], !isdef, &cfg); + isdef = !strcmp(sesslist.sessions[n], "Default Settings"); + load_settings(sesslist.sessions[n], !isdef, &cfg); init_dlg_ctrls(hwnd, TRUE); if (!isdef) - SetDlgItemText(hwnd, IDC_SESSEDIT, sessions[n]); + SetDlgItemText(hwnd, IDC_SESSEDIT, sesslist.sessions[n]); else SetDlgItemText(hwnd, IDC_SESSEDIT, ""); /* Restore the selection, which will have been clobbered by @@ -2040,6 +2228,7 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, /* XXX make it closed by default? */ treeview_insert(&tvfaff, 2, "Auth"); treeview_insert(&tvfaff, 2, "Tunnels"); + treeview_insert(&tvfaff, 2, "Bugs"); } } @@ -2125,6 +2314,8 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, create_controls(hwnd, dlgtype, sshpanelstart); if (!strcmp(buffer, "Auth")) create_controls(hwnd, dlgtype, sshauthpanelstart); + if (!strcmp(buffer, "Bugs")) + create_controls(hwnd, dlgtype, sshbugspanelstart); if (!strcmp(buffer, "Selection")) create_controls(hwnd, dlgtype, selectionpanelstart); if (!strcmp(buffer, "Colours")) @@ -2262,20 +2453,20 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, MessageBeep(0); break; } - strcpy(str, sessions[n]); + strcpy(str, sesslist.sessions[n]); } save_settings(str, !!strcmp(str, "Default Settings"), &cfg); - get_sesslist(FALSE); - get_sesslist(TRUE); + get_sesslist(&sesslist, FALSE); + get_sesslist(&sesslist, TRUE); SendDlgItemMessage(hwnd, IDC_SESSLIST, WM_SETREDRAW, FALSE, 0); SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_RESETCONTENT, 0, 0); - for (i = 0; i < nsessions; i++) + for (i = 0; i < sesslist.nsessions; i++) SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_ADDSTRING, 0, - (LPARAM) (sessions[i])); + (LPARAM) (sesslist.sessions[i])); SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_SETCURSEL, (WPARAM) - 1, 0); SendDlgItemMessage(hwnd, IDC_SESSLIST, WM_SETREDRAW, @@ -2321,17 +2512,17 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, MessageBeep(0); break; } - del_settings(sessions[n]); - get_sesslist(FALSE); - get_sesslist(TRUE); + del_settings(sesslist.sessions[n]); + get_sesslist(&sesslist, FALSE); + get_sesslist(&sesslist, TRUE); SendDlgItemMessage(hwnd, IDC_SESSLIST, WM_SETREDRAW, FALSE, 0); SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_RESETCONTENT, 0, 0); - for (i = 0; i < nsessions; i++) + for (i = 0; i < sesslist.nsessions; i++) SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_ADDSTRING, 0, - (LPARAM) (sessions[i])); + (LPARAM) (sesslist.sessions[i])); SendDlgItemMessage(hwnd, IDC_SESSLIST, LB_SETCURSEL, (WPARAM) - 1, 0); SendDlgItemMessage(hwnd, IDC_SESSLIST, WM_SETREDRAW, @@ -2487,11 +2678,11 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) { if (LOWORD(wParam) == IDC_ECHOBACKEND) - cfg.localecho = LD_BACKEND; + cfg.localecho = AUTO; if (LOWORD(wParam) == IDC_ECHOYES) - cfg.localecho = LD_YES; + cfg.localecho = FORCE_ON; if (LOWORD(wParam) == IDC_ECHONO) - cfg.localecho = LD_NO; + cfg.localecho = FORCE_OFF; } break; case IDC_EDITBACKEND: @@ -2500,11 +2691,11 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) { if (LOWORD(wParam) == IDC_EDITBACKEND) - cfg.localedit = LD_BACKEND; + cfg.localedit = AUTO; if (LOWORD(wParam) == IDC_EDITYES) - cfg.localedit = LD_YES; + cfg.localedit = FORCE_ON; if (LOWORD(wParam) == IDC_EDITNO) - cfg.localedit = LD_NO; + cfg.localedit = FORCE_OFF; } break; case IDC_ANSWEREDIT: @@ -2719,7 +2910,7 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) cfg.win_name_always = - IsDlgButtonChecked(hwnd, IDC_WINNAME); + !IsDlgButtonChecked(hwnd, IDC_WINNAME); break; case IDC_HIDEMOUSE: if (HIWORD(wParam) == BN_CLICKED || @@ -2801,10 +2992,10 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, HIWORD(wParam) == BN_DOUBLECLICKED) { cfg.close_on_exit = IsDlgButtonChecked(hwnd, - IDC_COEALWAYS) ? COE_ALWAYS : + IDC_COEALWAYS) ? FORCE_ON : IsDlgButtonChecked(hwnd, - IDC_COENEVER) ? COE_NEVER : - COE_NORMAL; + IDC_COENEVER) ? FORCE_OFF : + AUTO; } break; case IDC_CLOSEWARN: @@ -2871,6 +3062,23 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, IsDlgButtonChecked(hwnd, IDC_PROXYSOCKSVER4) ? 4 : 5; } break; + case IDC_PROXYLOCALHOST: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.even_proxy_localhost = + IsDlgButtonChecked(hwnd, IDC_PROXYLOCALHOST); + break; + case IDC_PROXYDNSNO: + case IDC_PROXYDNSAUTO: + case IDC_PROXYDNSYES: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) { + cfg.proxy_dns = + IsDlgButtonChecked(hwnd, IDC_PROXYDNSNO) ? FORCE_OFF : + IsDlgButtonChecked(hwnd, IDC_PROXYDNSYES) ? FORCE_ON : + AUTO; + } + break; case IDC_PROXYTYPENONE: case IDC_PROXYTYPEHTTP: case IDC_PROXYTYPESOCKS: @@ -3055,12 +3263,6 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, cfg.compression = IsDlgButtonChecked(hwnd, IDC_COMPRESS); break; - case IDC_BUGGYMAC: - if (HIWORD(wParam) == BN_CLICKED || - HIWORD(wParam) == BN_DOUBLECLICKED) - cfg.buggymac = - IsDlgButtonChecked(hwnd, IDC_BUGGYMAC); - break; case IDC_SSH2DES: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) @@ -3086,14 +3288,20 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, cfg.ssh_cipherlist, CIPHER_MAX, 0, hwnd, wParam, lParam); break; + case IDC_SSHPROT1ONLY: case IDC_SSHPROT1: case IDC_SSHPROT2: + case IDC_SSHPROT2ONLY: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) { + if (IsDlgButtonChecked(hwnd, IDC_SSHPROT1ONLY)) + cfg.sshprot = 0; if (IsDlgButtonChecked(hwnd, IDC_SSHPROT1)) cfg.sshprot = 1; else if (IsDlgButtonChecked(hwnd, IDC_SSHPROT2)) cfg.sshprot = 2; + else if (IsDlgButtonChecked(hwnd, IDC_SSHPROT2ONLY)) + cfg.sshprot = 3; } break; case IDC_AUTHTIS: @@ -3126,7 +3334,8 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, of.lStructSize = sizeof(of); #endif of.hwndOwner = hwnd; - of.lpstrFilter = "All Files\0*\0\0\0"; + of.lpstrFilter = "PuTTY Private Key Files (*.ppk)\0*.PPK\0" + "AllFiles\0*\0\0\0"; of.lpstrCustomFilter = NULL; of.nFilterIndex = 1; of.lpstrFile = filename; @@ -3342,6 +3551,16 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, GetDlgItemText(hwnd, IDC_X11_DISPLAY, cfg.x11_display, sizeof(cfg.x11_display) - 1); break; + case IDC_X11MIT: + case IDC_X11XDM: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) { + if (IsDlgButtonChecked(hwnd, IDC_X11MIT)) + cfg.x11_auth = X11_MIT; + else if (IsDlgButtonChecked(hwnd, IDC_X11XDM)) + cfg.x11_auth = X11_XDM; + } + break; case IDC_PFWDADD: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) { @@ -3426,6 +3645,62 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, disaster2:; } break; + case IDC_BUGD_IGNORE1: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_BUGD_IGNORE1, + CB_GETCURSEL, 0, 0); + cfg.sshbug_ignore1 = (index == 0 ? AUTO : + index == 1 ? FORCE_OFF : FORCE_ON); + } + break; + case IDC_BUGD_PLAINPW1: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_BUGD_PLAINPW1, + CB_GETCURSEL, 0, 0); + cfg.sshbug_plainpw1 = (index == 0 ? AUTO : + index == 1 ? FORCE_OFF : FORCE_ON); + } + break; + case IDC_BUGD_RSA1: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_BUGD_RSA1, + CB_GETCURSEL, 0, 0); + cfg.sshbug_rsa1 = (index == 0 ? AUTO : + index == 1 ? FORCE_OFF : FORCE_ON); + } + break; + case IDC_BUGD_HMAC2: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_BUGD_HMAC2, + CB_GETCURSEL, 0, 0); + cfg.sshbug_hmac2 = (index == 0 ? AUTO : + index == 1 ? FORCE_OFF : FORCE_ON); + } + break; + case IDC_BUGD_DERIVEKEY2: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_BUGD_DERIVEKEY2, + CB_GETCURSEL, 0, 0); + cfg.sshbug_derivekey2 = (index == 0 ? AUTO : + index == 1 ? FORCE_OFF:FORCE_ON); + } + break; + case IDC_BUGD_RSAPAD2: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_BUGD_RSAPAD2, + CB_GETCURSEL, 0, 0); + cfg.sshbug_rsapad2 = (index == 0 ? AUTO : + index == 1 ? FORCE_OFF : FORCE_ON); + } + break; + case IDC_BUGD_DHGEX2: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_BUGD_DHGEX2, + CB_GETCURSEL, 0, 0); + cfg.sshbug_dhgex2 = (index == 0 ? AUTO : + index == 1 ? FORCE_OFF : FORCE_ON); + } + break; } return 0; case WM_HELP: @@ -3518,11 +3793,11 @@ int do_config(void) { int ret; - get_sesslist(TRUE); + get_sesslist(&sesslist, TRUE); savedsession[0] = '\0'; ret = DialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL, MainDlgProc); - get_sesslist(FALSE); + get_sesslist(&sesslist, FALSE); return ret; } @@ -3541,11 +3816,13 @@ int do_reconfig(HWND hwnd) return ret; } -void logevent(char *string) +void logevent(void *frontend, char *string) { char timebuf[40]; time_t t; + log_eventlog(logctx, string); + if (nevents >= negsize) { negsize += 64; events = srealloc(events, negsize * sizeof(*events)); @@ -3583,7 +3860,7 @@ void showabout(HWND hwnd) DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTBOX), hwnd, AboutProc); } -void verify_ssh_host_key(char *host, int port, char *keytype, +void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype, char *keystr, char *fingerprint) { int ret; @@ -3659,7 +3936,7 @@ void verify_ssh_host_key(char *host, int port, char *keytype, * below the configured 'warn' threshold). * cs: 0 = both ways, 1 = client->server, 2 = server->client */ -void askcipher(char *ciphername, int cs) +void askcipher(void *frontend, char *ciphername, int cs) { static const char mbtitle[] = "PuTTY Security Alert"; static const char msg[] = @@ -3688,7 +3965,7 @@ void askcipher(char *ciphername, int cs) * Ask whether to wipe a session log file before writing to it. * Returns 2 for wipe, 1 for append, 0 for cancel (don't log). */ -int askappend(char *filename) +int askappend(void *frontend, char *filename) { static const char mbtitle[] = "PuTTY Log to File"; static const char msgtemplate[] = @@ -3700,9 +3977,7 @@ int askappend(char *filename) "or Cancel to disable logging."; char message[sizeof(msgtemplate) + FILENAME_MAX]; int mbret; - if (cfg.logxfovr != LGXF_ASK) { - return ((cfg.logxfovr == LGXF_OVR) ? 2 : 1); - } + sprintf(message, msgtemplate, FILENAME_MAX, filename); mbret = MessageBox(NULL, message, mbtitle, @@ -3717,6 +3992,13 @@ int askappend(char *filename) /* * Warn about the obsolescent key file format. + * + * Uniquely among these functions, this one does _not_ expect a + * frontend handle. This means that if PuTTY is ported to a + * platform which requires frontend handles, this function will be + * an anomaly. Fortunately, the problem it addresses will not have + * been present on that platform, so it can plausibly be + * implemented as an empty function. */ void old_keyfile_warning(void) {