1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Small window-handling tweaks. Set the default big window to 0x7fffffff bytes,

and tweak ssh2_set_window() so it can cope with that.  Also arrange to send
a private channel message in simple mode to tell the server that it can safely
use a large window too.

[originally from svn r7679]
This commit is contained in:
Ben Harris 2007-08-05 14:18:43 +00:00
parent 486771ec4a
commit 16cbd4f260

20
ssh.c
View File

@ -472,13 +472,13 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
* channels.
*
* - OUR_V2_BIGWIN is the window size we advertise for the only
* channel in a simple connection.
* channel in a simple connection. It must be <= INT_MAX.
*/
#define SSH1_BUFFER_LIMIT 32768
#define SSH_MAX_BACKLOG 32768
#define OUR_V2_WINSIZE 16384
#define OUR_V2_BIGWIN 0x10000000
#define OUR_V2_BIGWIN 0x7fffffff
#define OUR_V2_MAXPKT 0x4000UL
/* Maximum length of passwords/passphrases (arbitrary) */
@ -6191,7 +6191,7 @@ static void ssh2_set_window(struct ssh_channel *c, unsigned newwin)
*
* "Significant" is arbitrarily defined as half the window size.
*/
if (newwin >= c->v.v2.locwindow * 2) {
if (newwin / 2 >= c->v.v2.locwindow) {
struct Packet *pktout;
pktout = ssh2_pkt_init(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
@ -8060,6 +8060,20 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
ssh->packet_dispatch[SSH2_MSG_CHANNEL_OPEN] =
ssh2_msg_channel_open;
if (ssh->cfg.ssh_simple) {
/*
* This message indicates to the server that we promise
* not to try to run any other channel in parallel with
* this one, so it's safe for it to advertise a very large
* window and leave the flow control to TCP.
*/
s->pktout = ssh2_pkt_init(SSH2_MSG_CHANNEL_REQUEST);
ssh2_pkt_adduint32(s->pktout, ssh->mainchan->remoteid);
ssh2_pkt_addstring(s->pktout, "simple@putty.projects.tartarus.org");
ssh2_pkt_addbool(s->pktout, 0); /* no reply */
ssh2_pkt_send(ssh, s->pktout);
}
/*
* Potentially enable X11 forwarding.
*/