From 6e48c3fe152811248aad723336445e6e81ec3080 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 24 Oct 2000 09:49:03 +0000 Subject: [PATCH] Window resizing wasn't working in SSH2 git-svn-id: svn://svn.tartarus.org/sgt/putty@753 cda61777-01e9-0310-a592-d414129be87e --- ssh.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/ssh.c b/ssh.c index 744c86d3..a7f41307 100644 --- a/ssh.c +++ b/ssh.c @@ -2304,6 +2304,7 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt) ssh2_pkt_addstring_start(); ssh2_pkt_addstring_data("\0", 1);/* TTY_OP_END, no special options */ ssh2_pkt_send(); + ssh_state = SSH_STATE_INTERMED; do { crWaitUntilV(ispkt); @@ -2360,6 +2361,10 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt) logevent("Started a shell/command"); } + ssh_state = SSH_STATE_SESSION; + if (size_needed) + ssh_size(); + /* * Transfer data! */ @@ -2515,7 +2520,7 @@ static void ssh_send (char *buf, int len) { } /* - * Called to set the size of the window from Telnet's POV. + * Called to set the size of the window from SSH's POV. */ static void ssh_size(void) { switch (ssh_state) { @@ -2527,9 +2532,21 @@ static void ssh_size(void) { break; case SSH_STATE_SESSION: if (!cfg.nopty) { - send_packet(SSH1_CMSG_WINDOW_SIZE, - PKT_INT, rows, PKT_INT, cols, - PKT_INT, 0, PKT_INT, 0, PKT_END); + if (ssh_version == 1) { + send_packet(SSH1_CMSG_WINDOW_SIZE, + PKT_INT, rows, PKT_INT, cols, + PKT_INT, 0, PKT_INT, 0, PKT_END); + } else { + ssh2_pkt_init(SSH2_MSG_CHANNEL_REQUEST); + ssh2_pkt_adduint32(mainchan->remoteid); + ssh2_pkt_addstring("window-change"); + ssh2_pkt_addbool(0); + ssh2_pkt_adduint32(cols); + ssh2_pkt_adduint32(rows); + ssh2_pkt_adduint32(0); + ssh2_pkt_adduint32(0); + ssh2_pkt_send(); + } } } } -- 2.11.0