From cf6e59d623fbfd4efad0d63795ae5e7f33d5aa5b Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 12 Oct 2000 13:34:46 +0000 Subject: [PATCH] Miscellaneous fixes for better interoperation with commercial SSH 2 git-svn-id: svn://svn.tartarus.org/sgt/putty@708 cda61777-01e9-0310-a592-d414129be87e --- plink.c | 2 ++ ssh.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plink.c b/plink.c index 89b2f2c7..10a4ec10 100644 --- a/plink.c +++ b/plink.c @@ -511,6 +511,8 @@ int main(int argc, char **argv) { back->special(TS_EOF); } } + if (back->socket() == INVALID_SOCKET) + break; /* we closed the connection */ } WSACleanup(); return 0; diff --git a/ssh.c b/ssh.c index 7d1ce260..29cddc44 100644 --- a/ssh.c +++ b/ssh.c @@ -25,7 +25,7 @@ if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE)) \ fprintf(stderr, "%s\n", s); } -#define bombout(msg) ( ssh_state == SSH_STATE_CLOSED, closesocket(s), \ +#define bombout(msg) ( ssh_state = SSH_STATE_CLOSED, closesocket(s), \ s = INVALID_SOCKET, connection_fatal msg ) #define SSH1_MSG_DISCONNECT 1 /* 0x1 */ @@ -2285,7 +2285,7 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt) ssh2_pkt_init(SSH2_MSG_CHANNEL_OPEN); ssh2_pkt_addstring("session"); ssh2_pkt_adduint32(mainchan->localid); - ssh2_pkt_adduint32(0x7FFFFFFFUL); /* our window size */ + ssh2_pkt_adduint32(0x8000UL); /* our window size */ ssh2_pkt_adduint32(0x4000UL); /* our max pkt size */ ssh2_pkt_send(); crWaitUntilV(ispkt); @@ -2429,6 +2429,9 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt) logevent("All channels closed. Disconnecting"); ssh2_pkt_init(SSH2_MSG_DISCONNECT); ssh2_pkt_send(); + ssh_state = SSH_STATE_CLOSED; + closesocket(s); + s = INVALID_SOCKET; } continue; /* remote sends close; ignore (FIXME) */ } else if (pktin.type == SSH2_MSG_CHANNEL_WINDOW_ADJUST) { -- 2.11.0