1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-05-28 07:14:48 -05:00

Add switch to choose SSH v1-versus-v2 protocol preference where both

are available

[originally from svn r584]
This commit is contained in:
Simon Tatham 2000-09-11 09:37:43 +00:00
parent 22f91a3604
commit 334b79e16c
5 changed files with 31 additions and 5 deletions

View File

@ -139,6 +139,7 @@ typedef struct {
int nopty;
enum { CIPHER_3DES, CIPHER_BLOWFISH, CIPHER_DES } cipher;
char keyfile[FILENAME_MAX];
int sshprot; /* use v1 or v2 when both available */
int try_tis_auth;
/* Telnet options */
char termtype[32];

6
ssh.c
View File

@ -952,7 +952,11 @@ static int do_ssh_init(void) {
vlog[strcspn(vlog, "\r\n")] = '\0';
logevent(vlog);
if (ssh_versioncmp(version, "2.0" /* FIXME: "1.99" */ ) >= 0) {
/*
* Server version "1.99" means we can choose whether we use v1
* or v2 protocol. Choice is based on cfg.sshprot.
*/
if (ssh_versioncmp(version, cfg.sshprot == 1 ? "2.0" : "1.99") >= 0) {
/*
* This is a v2 server. Begin v2 protocol.
*/

View File

@ -114,6 +114,9 @@
#define IDC3_PKSTATIC 1024
#define IDC3_PKEDIT 1025
#define IDC3_PKBUTTON 1026
#define IDC3_SSHPROTSTATIC 1027
#define IDC3_SSHPROT1 1028
#define IDC3_SSHPROT2 1029
#define IDC4_MBSTATIC 1001
#define IDC4_MBWINDOWS 1002

View File

@ -238,10 +238,15 @@ BEGIN
AUTOCHECKBOX "Attempt TIS authentication", IDC3_AUTHTIS, 3, 55, 162, 8
LTEXT "Public key file:", IDC3_PKSTATIC, 3, 75, 119, 8
EDITTEXT IDC3_PKEDIT, 3, 83, 119, 12, ES_AUTOHSCROLL
LTEXT "Prefer protocol version:", IDC3_SSHPROTSTATIC, 3, 75, 105, 8
AUTORADIOBUTTON "&1", IDC3_SSHPROT1, 115, 75, 21, 8, WS_GROUP
AUTORADIOBUTTON "&2", IDC3_SSHPROT2, 143, 75, 21, 8
PUSHBUTTON "C&hange...", IDC3_PKBUTTON, 129, 83, 35, 12
LTEXT "Public key file:", IDC3_PKSTATIC, 3, 85, 119, 8
EDITTEXT IDC3_PKEDIT, 3, 93, 119, 12, ES_AUTOHSCROLL
PUSHBUTTON "C&hange...", IDC3_PKBUTTON, 129, 93, 35, 12
END
IDD_PANEL4 DIALOG DISCARDABLE 6, 30, 168, 163

View File

@ -153,6 +153,7 @@ static void save_settings (char *section, int do_host) {
wpps (sesskey, "Cipher", cfg.cipher == CIPHER_BLOWFISH ? "blowfish" :
cfg.cipher == CIPHER_DES ? "des" : "3des");
wppi (sesskey, "AuthTIS", cfg.try_tis_auth);
wppi (sesskey, "SshProt", cfg.sshprot);
wpps (sesskey, "PublicKeyFile", cfg.keyfile);
wppi (sesskey, "RFCEnviron", cfg.rfc_environ);
wppi (sesskey, "BackspaceIsDelete", cfg.bksp_is_delete);
@ -295,6 +296,7 @@ static void load_settings (char *section, int do_host) {
else
cfg.cipher = CIPHER_3DES;
}
gppi (sesskey, "SshProt", 1, &cfg.sshprot);
gppi (sesskey, "AuthTIS", 0, &cfg.try_tis_auth);
gpps (sesskey, "PublicKeyFile", "", cfg.keyfile, sizeof(cfg.keyfile));
gppi (sesskey, "RFCEnviron", 0, &cfg.rfc_environ);
@ -1010,8 +1012,9 @@ static int CALLBACK SshProc (HWND hwnd, UINT msg,
CheckRadioButton (hwnd, IDC3_CIPHER3DES, IDC3_CIPHERDES,
cfg.cipher == CIPHER_BLOWFISH ? IDC3_CIPHERBLOWF :
cfg.cipher == CIPHER_DES ? IDC3_CIPHERDES :
IDC3_CIPHER3DES);
CheckRadioButton (hwnd, IDC3_SSHPROT1, IDC3_SSHPROT2,
cfg.sshprot == 1 ? IDC3_SSHPROT1 : IDC3_SSHPROT2);
CheckDlgButton (hwnd, IDC3_AUTHTIS, cfg.try_tis_auth);
SetDlgItemText (hwnd, IDC3_PKEDIT, cfg.keyfile);
break;
@ -1045,6 +1048,16 @@ static int CALLBACK SshProc (HWND hwnd, UINT msg,
cfg.cipher = CIPHER_DES;
}
break;
case IDC3_SSHPROT1:
case IDC3_SSHPROT2:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED) {
if (IsDlgButtonChecked (hwnd, IDC3_SSHPROT1))
cfg.sshprot = 1;
else if (IsDlgButtonChecked (hwnd, IDC3_SSHPROT2))
cfg.sshprot = 2;
}
break;
case IDC3_AUTHTIS:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)