mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
From RDB: telnet can now start up in passive mode, in which it
doesn't do any negotiation until the remote side does. [originally from svn r1107]
This commit is contained in:
parent
7d86bbfbe2
commit
d1d65fa6d0
1
putty.h
1
putty.h
@ -196,6 +196,7 @@ typedef struct {
|
|||||||
char username[32];
|
char username[32];
|
||||||
char localusername[32];
|
char localusername[32];
|
||||||
int rfc_environ;
|
int rfc_environ;
|
||||||
|
int passive_telnet;
|
||||||
/* Keyboard options */
|
/* Keyboard options */
|
||||||
int bksp_is_delete;
|
int bksp_is_delete;
|
||||||
int rxvt_homeend;
|
int rxvt_homeend;
|
||||||
|
@ -86,6 +86,7 @@ void save_settings(char *section, int do_host, Config * cfg)
|
|||||||
write_setting_s(sesskey, "PublicKeyFile", cfg->keyfile);
|
write_setting_s(sesskey, "PublicKeyFile", cfg->keyfile);
|
||||||
write_setting_s(sesskey, "RemoteCommand", cfg->remote_cmd);
|
write_setting_s(sesskey, "RemoteCommand", cfg->remote_cmd);
|
||||||
write_setting_i(sesskey, "RFCEnviron", cfg->rfc_environ);
|
write_setting_i(sesskey, "RFCEnviron", cfg->rfc_environ);
|
||||||
|
write_setting_i(sesskey, "PassiveTelnet", cfg->passive_telnet);
|
||||||
write_setting_i(sesskey, "BackspaceIsDelete", cfg->bksp_is_delete);
|
write_setting_i(sesskey, "BackspaceIsDelete", cfg->bksp_is_delete);
|
||||||
write_setting_i(sesskey, "RXVTHomeEnd", cfg->rxvt_homeend);
|
write_setting_i(sesskey, "RXVTHomeEnd", cfg->rxvt_homeend);
|
||||||
write_setting_i(sesskey, "LinuxFunctionKeys", cfg->funky_type);
|
write_setting_i(sesskey, "LinuxFunctionKeys", cfg->funky_type);
|
||||||
@ -248,6 +249,7 @@ void load_settings(char *section, int do_host, Config * cfg)
|
|||||||
gpps(sesskey, "RemoteCommand", "", cfg->remote_cmd,
|
gpps(sesskey, "RemoteCommand", "", cfg->remote_cmd,
|
||||||
sizeof(cfg->remote_cmd));
|
sizeof(cfg->remote_cmd));
|
||||||
gppi(sesskey, "RFCEnviron", 0, &cfg->rfc_environ);
|
gppi(sesskey, "RFCEnviron", 0, &cfg->rfc_environ);
|
||||||
|
gppi(sesskey, "PassiveTelnet", 0, &cfg->passive_telnet);
|
||||||
gppi(sesskey, "BackspaceIsDelete", 1, &cfg->bksp_is_delete);
|
gppi(sesskey, "BackspaceIsDelete", 1, &cfg->bksp_is_delete);
|
||||||
gppi(sesskey, "RXVTHomeEnd", 0, &cfg->rxvt_homeend);
|
gppi(sesskey, "RXVTHomeEnd", 0, &cfg->rxvt_homeend);
|
||||||
gppi(sesskey, "LinuxFunctionKeys", 0, &cfg->funky_type);
|
gppi(sesskey, "LinuxFunctionKeys", 0, &cfg->funky_type);
|
||||||
|
27
telnet.c
27
telnet.c
@ -175,6 +175,7 @@ static struct Opt *opts[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int echoing = TRUE, editing = TRUE;
|
static int echoing = TRUE, editing = TRUE;
|
||||||
|
static int activated = FALSE;
|
||||||
|
|
||||||
static int in_synch;
|
static int in_synch;
|
||||||
static int sb_opt, sb_len;
|
static int sb_opt, sb_len;
|
||||||
@ -226,6 +227,23 @@ static void option_side_effects(struct Opt *o, int enabled)
|
|||||||
else if (o->option == TELOPT_SGA && o->send == DO)
|
else if (o->option == TELOPT_SGA && o->send == DO)
|
||||||
editing = !enabled;
|
editing = !enabled;
|
||||||
ldisc_send(NULL, 0); /* cause ldisc to notice the change */
|
ldisc_send(NULL, 0); /* cause ldisc to notice the change */
|
||||||
|
|
||||||
|
/* Ensure we get the minimum options */
|
||||||
|
if (!activated) {
|
||||||
|
if (o_echo.state == INACTIVE) {
|
||||||
|
o_echo.state = REQUESTED;
|
||||||
|
send_opt(o_echo.send, o_echo.option);
|
||||||
|
}
|
||||||
|
if (o_we_sga.state == INACTIVE) {
|
||||||
|
o_we_sga.state = REQUESTED;
|
||||||
|
send_opt(o_we_sga.send, o_we_sga.option);
|
||||||
|
}
|
||||||
|
if (o_they_sga.state == INACTIVE) {
|
||||||
|
o_they_sga.state = REQUESTED;
|
||||||
|
send_opt(o_they_sga.send, o_they_sga.option);
|
||||||
|
}
|
||||||
|
activated = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void activate_option(struct Opt *o)
|
static void activate_option(struct Opt *o)
|
||||||
@ -603,12 +621,19 @@ static char *telnet_init(char *host, int port, char **realhost)
|
|||||||
/*
|
/*
|
||||||
* Initialise option states.
|
* Initialise option states.
|
||||||
*/
|
*/
|
||||||
{
|
if (cfg.passive_telnet) {
|
||||||
|
struct Opt **o;
|
||||||
|
|
||||||
|
for (o = opts; *o; o++)
|
||||||
|
if ((*o)->state == REQUESTED)
|
||||||
|
(*o)->state = INACTIVE;
|
||||||
|
} else {
|
||||||
struct Opt **o;
|
struct Opt **o;
|
||||||
|
|
||||||
for (o = opts; *o; o++)
|
for (o = opts; *o; o++)
|
||||||
if ((*o)->state == REQUESTED)
|
if ((*o)->state == REQUESTED)
|
||||||
send_opt((*o)->send, (*o)->option);
|
send_opt((*o)->send, (*o)->option);
|
||||||
|
activated = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
15
windlg.c
15
windlg.c
@ -408,6 +408,9 @@ enum { IDCX_ABOUT =
|
|||||||
IDC_EMSTATIC,
|
IDC_EMSTATIC,
|
||||||
IDC_EMBSD,
|
IDC_EMBSD,
|
||||||
IDC_EMRFC,
|
IDC_EMRFC,
|
||||||
|
IDC_ACTSTATIC,
|
||||||
|
IDC_TPASSIVE,
|
||||||
|
IDC_TACTIVE,
|
||||||
telnetpanelend,
|
telnetpanelend,
|
||||||
|
|
||||||
rloginpanelstart,
|
rloginpanelstart,
|
||||||
@ -658,6 +661,8 @@ static void init_dlg_ctrls(HWND hwnd)
|
|||||||
}
|
}
|
||||||
CheckRadioButton(hwnd, IDC_EMBSD, IDC_EMRFC,
|
CheckRadioButton(hwnd, IDC_EMBSD, IDC_EMRFC,
|
||||||
cfg.rfc_environ ? IDC_EMRFC : IDC_EMBSD);
|
cfg.rfc_environ ? IDC_EMRFC : IDC_EMBSD);
|
||||||
|
CheckRadioButton(hwnd, IDC_TPASSIVE, IDC_TACTIVE,
|
||||||
|
cfg.passive_telnet ? IDC_TPASSIVE : IDC_TACTIVE);
|
||||||
|
|
||||||
SetDlgItemText(hwnd, IDC_TTEDIT, cfg.termtype);
|
SetDlgItemText(hwnd, IDC_TTEDIT, cfg.termtype);
|
||||||
SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username);
|
SetDlgItemText(hwnd, IDC_LOGEDIT, cfg.username);
|
||||||
@ -1102,7 +1107,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (panel == telnetpanelstart) {
|
if (panel == telnetpanelstart) {
|
||||||
/* The Telnet panel. Accelerators used: [acgo] svldr bf */
|
/* The Telnet panel. Accelerators used: [acgo] svldr bft */
|
||||||
struct ctlpos cp;
|
struct ctlpos cp;
|
||||||
ctlposinit(&cp, hwnd, 80, 3, 13);
|
ctlposinit(&cp, hwnd, 80, 3, 13);
|
||||||
if (dlgtype == 0) {
|
if (dlgtype == 0) {
|
||||||
@ -1120,6 +1125,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
|
|||||||
radioline(&cp, "Handling of OLD_ENVIRON ambiguity:",
|
radioline(&cp, "Handling of OLD_ENVIRON ambiguity:",
|
||||||
IDC_EMSTATIC, 2, "&BSD (commonplace)", IDC_EMBSD,
|
IDC_EMSTATIC, 2, "&BSD (commonplace)", IDC_EMBSD,
|
||||||
"R&FC 1408 (unusual)", IDC_EMRFC, NULL);
|
"R&FC 1408 (unusual)", IDC_EMRFC, NULL);
|
||||||
|
radioline(&cp, "&Telnet negotiation mode:", IDC_ACTSTATIC, 2,
|
||||||
|
"Passive", IDC_TPASSIVE, "Active",
|
||||||
|
IDC_TACTIVE, NULL);
|
||||||
endbox(&cp);
|
endbox(&cp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1987,6 +1995,11 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
|
|||||||
case IDC_EMRFC:
|
case IDC_EMRFC:
|
||||||
cfg.rfc_environ = IsDlgButtonChecked(hwnd, IDC_EMRFC);
|
cfg.rfc_environ = IsDlgButtonChecked(hwnd, IDC_EMRFC);
|
||||||
break;
|
break;
|
||||||
|
case IDC_TPASSIVE:
|
||||||
|
case IDC_TACTIVE:
|
||||||
|
cfg.passive_telnet =
|
||||||
|
IsDlgButtonChecked(hwnd, IDC_TPASSIVE);
|
||||||
|
break;
|
||||||
case IDC_ENVADD:
|
case IDC_ENVADD:
|
||||||
if (HIWORD(wParam) == BN_CLICKED ||
|
if (HIWORD(wParam) == BN_CLICKED ||
|
||||||
HIWORD(wParam) == BN_DOUBLECLICKED) {
|
HIWORD(wParam) == BN_DOUBLECLICKED) {
|
||||||
|
Loading…
Reference in New Issue
Block a user