From 4252c9cc7d88ca10cfaeaea2dd2510aabfdc0f38 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 18 Sep 2001 18:16:56 +0000 Subject: [PATCH] SSH back end should now be tolerant of garbage appearing in the data stream after the actual SSH connection is finished. Some firewalls add this for no good reason. git-svn-id: svn://svn.tartarus.org/sgt/putty@1271 cda61777-01e9-0310-a592-d414129be87e --- ssh.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ssh.c b/ssh.c index 27b7216d..4a6db9f6 100644 --- a/ssh.c +++ b/ssh.c @@ -607,12 +607,6 @@ static int ssh1_rdpkt(unsigned char **data, int *datalen) (*data)++, (*datalen)--; } -#ifdef FWHACK - if (st->len == 0x52656d6f) { /* "Remo"te server has closed ... */ - st->len = 0x300; /* big enough to carry to end */ - } -#endif - st->pad = 8 - (st->len % 8); st->biglen = st->len + st->pad; pktin.length = st->len - 5; @@ -770,11 +764,7 @@ static int ssh2_rdpkt(unsigned char **data, int *datalen) pktin.data[st->i] = *(*data)++; (*datalen)--; } -#ifdef FWHACK - if (!memcmp(pktin.data, "Remo", 4)) { /* "Remo"te server has closed ... */ - /* FIXME */ - } -#endif + if (sccipher) sccipher->decrypt(pktin.data, st->cipherblk); @@ -3005,6 +2995,15 @@ static void ssh1_protocol(unsigned char *in, int inlen, int ispkt) * if no pty is available or in other odd cases. Ignore */ } else if (pktin.type == SSH1_SMSG_EXIT_STATUS) { send_packet(SSH1_CMSG_EXIT_CONFIRMATION, PKT_END); + /* + * In case `helpful' firewalls or proxies tack + * extra human-readable text on the end of the + * session which we might mistake for another + * encrypted packet, we close the session once + * we've sent EXIT_CONFIRMATION. + */ + ssh_state = SSH_STATE_CLOSED; + crReturnV; } else { bombout(("Strange packet received: type %d", pktin.type)); crReturnV; -- 2.11.0