From: simon Date: Tue, 23 Mar 1999 17:21:44 +0000 (+0000) Subject: Add SSH_STATE_CLOSED to prevent accidentally sending resizes down a X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/212482607f696e09d5c3688cd0aa967b7fc3bc07?hp=1bb542b2d891036ca5e9a80c2ce64621bb9318be Add SSH_STATE_CLOSED to prevent accidentally sending resizes down a closed connection; was causing process hangs under NT and whole- system hangs under '95 git-svn-id: svn://svn.tartarus.org/sgt/putty@126 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/ssh.c b/ssh.c index 633453d6..f29f87c4 100644 --- a/ssh.c +++ b/ssh.c @@ -47,7 +47,8 @@ static char *savedhost; static enum { SSH_STATE_BEFORE_SIZE, SSH_STATE_INTERMED, - SSH_STATE_SESSION + SSH_STATE_SESSION, + SSH_STATE_CLOSED } ssh_state = SSH_STATE_BEFORE_SIZE; static int size_needed = FALSE; @@ -478,7 +479,8 @@ static void ssh_protocol(unsigned char *in, int inlen, int ispkt) { len = (len << 8) + pktin.body[i]; c_write(pktin.body+4, len); } else if (pktin.type == 1) { - /* SSH_MSG_DISCONNECT: do nothing */ + /* SSH_MSG_DISCONNECT */ + ssh_state = SSH_STATE_CLOSED; } else if (pktin.type == 14) { /* SSH_MSG_SUCCESS: may be from EXEC_SHELL on some servers */ } else if (pktin.type == 15) { @@ -647,6 +649,7 @@ static int ssh_msg (WPARAM wParam, LPARAM lParam) { return 1; case FD_CLOSE: s = INVALID_SOCKET; + ssh_state = SSH_STATE_CLOSED; return 0; } return 1; /* shouldn't happen, but WTF */ @@ -668,6 +671,7 @@ static void ssh_send (char *buf, int len) { static void ssh_size(void) { switch (ssh_state) { case SSH_STATE_BEFORE_SIZE: + case SSH_STATE_CLOSED: break; /* do nothing */ case SSH_STATE_INTERMED: size_needed = TRUE; /* buffer for later */