1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

Bug fix: line discipline selection is not enabled until after ssh

authentication phase to stop user/password prompts behaving oddly

[originally from svn r614]
This commit is contained in:
Simon Tatham 2000-09-22 13:10:19 +00:00
parent e5ef37f3f5
commit c0ac8ab9b4
7 changed files with 37 additions and 5 deletions

13
plink.c
View File

@ -32,12 +32,19 @@ void connection_fatal (char *p, ...) {
} }
HANDLE outhandle; HANDLE outhandle;
DWORD orig_console_mode;
void begin_session(void) {
if (!cfg.ldisc_term)
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT);
else
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), orig_console_mode);
}
void term_out(void) void term_out(void)
{ {
int reap; int reap;
DWORD ret; DWORD ret;
reap = 0; reap = 0;
while (reap < inbuf_head) { while (reap < inbuf_head) {
if (!WriteFile(outhandle, inbuf+reap, inbuf_head-reap, &ret, NULL)) if (!WriteFile(outhandle, inbuf+reap, inbuf_head-reap, &ret, NULL))
@ -277,8 +284,8 @@ int main(int argc, char **argv) {
netevent = CreateEvent(NULL, FALSE, FALSE, NULL); netevent = CreateEvent(NULL, FALSE, FALSE, NULL);
stdinevent = CreateEvent(NULL, FALSE, FALSE, NULL); stdinevent = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!cfg.ldisc_term) GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &orig_console_mode);
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT); SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT);
outhandle = GetStdHandle(STD_OUTPUT_HANDLE); outhandle = GetStdHandle(STD_OUTPUT_HANDLE);
/* /*

View File

@ -244,6 +244,7 @@ void optimised_move (int, int, int);
void connection_fatal(char *, ...); void connection_fatal(char *, ...);
void fatalbox (char *, ...); void fatalbox (char *, ...);
void beep (int); void beep (int);
void begin_session(void);
#define OPTIMISE_IS_SCROLL 1 #define OPTIMISE_IS_SCROLL 1
/* /*

5
raw.c
View File

@ -131,6 +131,11 @@ static char *raw_init (HWND hwnd, char *host, int port, char **realhost) {
default: return "WSAAsyncSelect(): unknown error"; default: return "WSAAsyncSelect(): unknown error";
} }
/*
* We have no pre-session phase.
*/
begin_session();
return NULL; return NULL;
} }

4
scp.c
View File

@ -68,12 +68,14 @@ static void send_str_msg(unsigned int msg_id, char *str);
static void gui_update_stats(char *name, unsigned long size, int percentage, time_t elapsed); static void gui_update_stats(char *name, unsigned long size, int percentage, time_t elapsed);
/* /*
* This function is needed to link with ssh.c, but it never gets called. * These functions are needed to link with ssh.c, but never get called.
*/ */
void term_out(void) void term_out(void)
{ {
abort(); abort();
} }
void begin_session(void) {
}
/* GUI Adaptation - Sept 2000 */ /* GUI Adaptation - Sept 2000 */
void send_msg(HWND h, UINT message, WPARAM wParam) void send_msg(HWND h, UINT message, WPARAM wParam)

2
ssh.c
View File

@ -1628,6 +1628,7 @@ static void ssh1_protocol(unsigned char *in, int inlen, int ispkt) {
ssh_send_ok = 1; ssh_send_ok = 1;
ssh_channels = newtree234(ssh_channelcmp); ssh_channels = newtree234(ssh_channelcmp);
begin_session();
while (1) { while (1) {
crReturnV; crReturnV;
if (ispkt) { if (ispkt) {
@ -2335,6 +2336,7 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
* Transfer data! * Transfer data!
*/ */
ssh_send_ok = 1; ssh_send_ok = 1;
begin_session();
while (1) { while (1) {
static int try_send; static int try_send;
crReturnV; crReturnV;

View File

@ -583,6 +583,12 @@ static char *telnet_init (HWND hwnd, char *host, int port, char **realhost) {
* Set up SYNCH state. * Set up SYNCH state.
*/ */
in_synch = FALSE; in_synch = FALSE;
/*
* We have no pre-session phase.
*/
begin_session();
return NULL; return NULL;
} }

View File

@ -82,6 +82,12 @@ static Mouse_Button lastbtn;
static char *window_name, *icon_name; static char *window_name, *icon_name;
static Ldisc *real_ldisc;
void begin_session(void) {
ldisc = real_ldisc;
}
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
static char appname[] = "PuTTY"; static char appname[] = "PuTTY";
WORD winsock_ver; WORD winsock_ver;
@ -239,7 +245,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
} }
} }
ldisc = (cfg.ldisc_term ? &ldisc_term : &ldisc_simple); real_ldisc = (cfg.ldisc_term ? &ldisc_term : &ldisc_simple);
/* To start with, we use the simple line discipline, so we can
* type passwords etc without fear of them being echoed... */
ldisc = &ldisc_simple;
if (!prev) { if (!prev) {
wndclass.style = 0; wndclass.style = 0;