]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Miscellaneous fixes for better interoperation with commercial SSH 2
authorSimon Tatham <anakin@pobox.com>
Thu, 12 Oct 2000 13:34:46 +0000 (13:34 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 12 Oct 2000 13:34:46 +0000 (13:34 +0000)
[originally from svn r708]

plink.c
ssh.c

diff --git a/plink.c b/plink.c
index 89b2f2c74bf9fbf7b5b70cefe8d74d81c21b6b5b..10a4ec10fca04e3dd1d4e13568148f3d454db7b6 100644 (file)
--- 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 7d1ce260e8f2fc54d249acccb1d7b063e1b286a5..29cddc44a73778a1e0cd544d8652609f64cc1553 100644 (file)
--- 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) {