Retired the #ifdef DUMP_PACKETS stuff in ssh.c because I'm utterly
[u/mdw/putty] / windlg.c
index c0da9c2..c3f13b7 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -257,6 +257,7 @@ enum { IDCX_ABOUT =
     IDC_LSTATOFF,
     IDC_LSTATASCII,
     IDC_LSTATRAW,
+    IDC_LSTATPACKET,
     IDC_LGFSTATIC,
     IDC_LGFEDIT,
     IDC_LGFBUTTON,
@@ -477,6 +478,7 @@ enum { IDCX_ABOUT =
     IDC_PKEDIT,
     IDC_PKBUTTON,
     IDC_AGENTFWD,
+    IDC_CHANGEUSER,
     IDC_AUTHTIS,
     IDC_AUTHKI,
     sshauthpanelend,
@@ -620,6 +622,7 @@ char *help_context_cmd(int id)
       case IDC_LSTATOFF:
       case IDC_LSTATASCII:
       case IDC_LSTATRAW:
+      case IDC_LSTATPACKET:
         return "JI(`',`logging.main')";
       case IDC_LGFSTATIC:
       case IDC_LGFEDIT:
@@ -833,6 +836,8 @@ char *help_context_cmd(int id)
         return "JI(`',`ssh.auth.privkey')";
       case IDC_AGENTFWD:
         return "JI(`',`ssh.auth.agentfwd')";
+      case IDC_CHANGEUSER:
+        return "JI(`',`ssh.auth.changeuser')";
       case IDC_AUTHTIS:
         return "JI(`',`ssh.auth.tis')";
       case IDC_AUTHKI:
@@ -1029,9 +1034,11 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     SetDlgItemText(hwnd, IDC_RLLUSEREDIT, cfg.localusername);
     SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username);
     SetDlgItemText(hwnd, IDC_LGFEDIT, cfg.logfilename);
-    CheckRadioButton(hwnd, IDC_LSTATOFF, IDC_LSTATRAW,
-                    cfg.logtype == 0 ? IDC_LSTATOFF :
-                    cfg.logtype == 1 ? IDC_LSTATASCII : IDC_LSTATRAW);
+    CheckRadioButton(hwnd, IDC_LSTATOFF, IDC_LSTATPACKET,
+                    cfg.logtype == LGTYP_NONE ? IDC_LSTATOFF :
+                    cfg.logtype == LGTYP_ASCII ? IDC_LSTATASCII :
+                    cfg.logtype == LGTYP_DEBUG ? IDC_LSTATRAW :
+                    IDC_LSTATPACKET);
     CheckRadioButton(hwnd, IDC_LSTATXOVR, IDC_LSTATXASK,
                     cfg.logxfovr == LGXF_OVR ? IDC_LSTATXOVR :
                     cfg.logxfovr == LGXF_ASK ? IDC_LSTATXASK :
@@ -1063,6 +1070,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
     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);
     CheckDlgButton(hwnd, IDC_AUTHTIS, cfg.try_tis_auth);
@@ -1250,7 +1258,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
     }
 
     if (panel == loggingpanelstart) {
-       /* The Logging panel. Accelerators used: [acgo] tplfwe */
+       /* The Logging panel. Accelerators used: [acgo] tplsfwe */
        struct ctlpos cp;
        ctlposinit(&cp, hwnd, 80, 3, 13);
        bartitle(&cp, "Options controlling session logging",
@@ -1260,7 +1268,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
                 "Session logging:", IDC_LSTATSTATIC,
                 "Logging &turned off completely", IDC_LSTATOFF,
                 "Log &printable output only", IDC_LSTATASCII,
-                "&Log all session output", IDC_LSTATRAW, NULL);
+                "&Log all session output", IDC_LSTATRAW,
+                "Log &SSH packet data", IDC_LSTATPACKET,
+                NULL);
        editbutton(&cp, "Log &file name:",
                   IDC_LGFSTATIC, IDC_LGFEDIT, "Bro&wse...",
                   IDC_LGFBUTTON);
@@ -1674,6 +1684,8 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
            beginbox(&cp, "Authentication parameters",
                     IDC_BOX_SSHAUTH2);
            checkbox(&cp, "Allow agent &forwarding", IDC_AGENTFWD);
+           checkbox(&cp, "Allow attempted changes of &username in SSH2",
+                    IDC_CHANGEUSER);
            editbutton(&cp, "Private &key file for authentication:",
                       IDC_PKSTATIC, IDC_PKEDIT, "Bro&wse...",
                       IDC_PKBUTTON);
@@ -2602,14 +2614,17 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
              case IDC_LSTATOFF:
              case IDC_LSTATASCII:
              case IDC_LSTATRAW:
+             case IDC_LSTATPACKET:
                if (HIWORD(wParam) == BN_CLICKED ||
                    HIWORD(wParam) == BN_DOUBLECLICKED) {
                    if (IsDlgButtonChecked(hwnd, IDC_LSTATOFF))
-                       cfg.logtype = 0;
+                       cfg.logtype = LGTYP_NONE;
                    if (IsDlgButtonChecked(hwnd, IDC_LSTATASCII))
-                       cfg.logtype = 1;
+                       cfg.logtype = LGTYP_ASCII;
                    if (IsDlgButtonChecked(hwnd, IDC_LSTATRAW))
-                       cfg.logtype = 2;
+                       cfg.logtype = LGTYP_DEBUG;
+                   if (IsDlgButtonChecked(hwnd, IDC_LSTATPACKET))
+                       cfg.logtype = LGTYP_PACKETS;
                }
                break;
              case IDC_LSTATXASK:
@@ -2756,6 +2771,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
                        cfg.agentfwd =
                        IsDlgButtonChecked(hwnd, IDC_AGENTFWD);
                break;
+             case IDC_CHANGEUSER:
+               if (HIWORD(wParam) == BN_CLICKED ||
+                   HIWORD(wParam) == BN_DOUBLECLICKED)
+                       cfg.change_username =
+                       IsDlgButtonChecked(hwnd, IDC_CHANGEUSER);
+               break;
              case IDC_CIPHERLIST:
              case IDC_CIPHERUP:
              case IDC_CIPHERDN: