diff -u openssh-3.9p1/buffer.c openssh-3.9p1-hpn/buffer.c --- openssh-3.9p1/buffer.c 2003-11-21 07:56:47.000000000 -0500 +++ openssh-3.9p1-hpn/buffer.c 2004-09-15 01:54:43.000000000 -0400 @@ -18,6 +18,12 @@ #include "buffer.h" #include "log.h" +void +set_unlimited(Buffer *buffer, int new_value) +{ + buffer->unlimited = new_value; +} + /* Initializes the buffer structure. */ void @@ -30,6 +36,7 @@ buffer->alloc = len; buffer->offset = 0; buffer->end = 0; + buffer->unlimited = 0; } /* Frees any memory used for the buffer. */ @@ -78,7 +85,8 @@ u_int newlen; void *p; - if (len > 0x100000) + if ((buffer->unlimited && len > MAXBUFSZ) || + (!buffer->unlimited && len > 0x100000)) fatal("buffer_append_space: len %u not supported", len); /* If the buffer is empty, start using it from the beginning. */ @@ -107,7 +115,8 @@ /* Increase the size of the buffer and retry. */ newlen = buffer->alloc + len + 32768; - if (newlen > 0xa00000) + if ((buffer->unlimited && newlen > MAXBUFSZ) || + (!buffer->unlimited && newlen > 0xa00000)) fatal("buffer_append_space: alloc %u not supported", newlen); buffer->buf = xrealloc(buffer->buf, newlen); diff -u openssh-3.9p1/buffer.h openssh-3.9p1-hpn/buffer.h --- openssh-3.9p1/buffer.h 2002-03-04 20:53:04.000000000 -0500 +++ openssh-3.9p1-hpn/buffer.h 2004-09-15 01:54:43.000000000 -0400 @@ -16,13 +16,18 @@ #ifndef BUFFER_H #define BUFFER_H +#define MAXBUFSZ (2<<29)-1 + typedef struct { u_char *buf; /* Buffer for data. */ u_int alloc; /* Number of bytes allocated for data. */ u_int offset; /* Offset of first byte containing data. */ u_int end; /* Offset of last byte containing data. */ + u_int unlimited; } Buffer; +void set_unlimited(Buffer *,int); + void buffer_init(Buffer *); void buffer_clear(Buffer *); void buffer_free(Buffer *); diff -u openssh-3.9p1/channels.c openssh-3.9p1-hpn/channels.c --- openssh-3.9p1/channels.c 2004-08-13 07:18:01.000000000 -0400 +++ openssh-3.9p1-hpn/channels.c 2004-09-15 01:54:43.000000000 -0400 @@ -257,6 +257,7 @@ c->local_window_max = window; c->local_consumed = 0; c->local_maxpacket = maxpack; + c->dynamic_window = 0; c->remote_id = -1; c->remote_name = xstrdup(remote_name); c->remote_window = 0; @@ -711,6 +712,10 @@ channel_pre_open(Channel *c, fd_set * readset, fd_set * writeset) { u_int limit = compat20 ? c->remote_window : packet_get_maxsize(); + if (!c->input.unlimited && limit > 0x10000) + limit = 0x10000; + else if (c->input.unlimited && limit > MAXBUFSZ) + limit = MAXBUFSZ; if (c->istate == CHAN_INPUT_OPEN && limit > 0 && @@ -1528,14 +1533,29 @@ !(c->flags & (CHAN_CLOSE_SENT|CHAN_CLOSE_RCVD)) && c->local_window < c->local_window_max/2 && c->local_consumed > 0) { + u_int32_t tcpwinsz = 0; + socklen_t optsz = sizeof(tcpwinsz); + int ret = -1; + u_int32_t addition = 0; + if (c->dynamic_window) { + ret = getsockopt(packet_get_connection_in(), + SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz); + if ((ret == 0) && tcpwinsz/2 > MAXBUFSZ) + tcpwinsz = MAXBUFSZ/2; + } + if (c->dynamic_window && (ret == 0) && + (2*tcpwinsz > c->local_window_max)) { + addition = 2 * tcpwinsz - c->local_window_max; + c->local_window_max += addition; + } packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST); packet_put_int(c->remote_id); - packet_put_int(c->local_consumed); + packet_put_int(c->local_consumed + addition); packet_send(); debug2("channel %d: window %d sent adjust %d", c->self, c->local_window, c->local_consumed); - c->local_window += c->local_consumed; + c->local_window += c->local_consumed + addition; c->local_consumed = 0; } return 1; Only in openssh-3.9p1-hpn: channels.c~ diff -u openssh-3.9p1/channels.h openssh-3.9p1-hpn/channels.h --- openssh-3.9p1/channels.h 2004-08-13 07:18:01.000000000 -0400 +++ openssh-3.9p1-hpn/channels.h 2004-09-15 01:54:43.000000000 -0400 @@ -98,6 +98,7 @@ u_int local_window_max; u_int local_consumed; u_int local_maxpacket; + int dynamic_window; int extended_usage; int single_connection; Only in openssh-3.9p1-hpn: channels.h~ diff -u openssh-3.9p1/compat.c openssh-3.9p1-hpn/compat.c --- openssh-3.9p1/compat.c 2003-11-03 04:09:03.000000000 -0500 +++ openssh-3.9p1-hpn/compat.c 2004-09-15 01:57:30.000000000 -0400 @@ -62,24 +62,35 @@ "OpenSSH_2.1*," "OpenSSH_2.2*", SSH_OLD_SESSIONID|SSH_BUG_BANNER| SSH_OLD_DHGEX|SSH_BUG_NOREKEY| - SSH_BUG_EXTEOF}, + SSH_BUG_EXTEOF|SSH_BUG_LARGEWINDOW}, { "OpenSSH_2.3.0*", SSH_BUG_BANNER|SSH_BUG_BIGENDIANAES| SSH_OLD_DHGEX|SSH_BUG_NOREKEY| - SSH_BUG_EXTEOF}, + SSH_BUG_EXTEOF|SSH_BUG_LARGEWINDOW}, { "OpenSSH_2.3.*", SSH_BUG_BIGENDIANAES|SSH_OLD_DHGEX| - SSH_BUG_NOREKEY|SSH_BUG_EXTEOF}, + SSH_BUG_NOREKEY|SSH_BUG_EXTEOF| + SSH_BUG_LARGEWINDOW}, { "OpenSSH_2.5.0p1*," "OpenSSH_2.5.1p1*", SSH_BUG_BIGENDIANAES|SSH_OLD_DHGEX| - SSH_BUG_NOREKEY|SSH_BUG_EXTEOF}, + SSH_BUG_NOREKEY|SSH_BUG_EXTEOF| + SSH_BUG_LARGEWINDOW}, { "OpenSSH_2.5.0*," "OpenSSH_2.5.1*," "OpenSSH_2.5.2*", SSH_OLD_DHGEX|SSH_BUG_NOREKEY| - SSH_BUG_EXTEOF}, - { "OpenSSH_2.5.3*", SSH_BUG_NOREKEY|SSH_BUG_EXTEOF}, + SSH_BUG_EXTEOF|SSH_BUG_LARGEWINDOW}, + { "OpenSSH_2.5.3*", SSH_BUG_NOREKEY|SSH_BUG_EXTEOF| + SSH_BUG_LARGEWINDOW}, { "OpenSSH_2.*," "OpenSSH_3.0*," - "OpenSSH_3.1*", SSH_BUG_EXTEOF}, + "OpenSSH_3.1*", SSH_BUG_EXTEOF|SSH_BUG_LARGEWINDOW}, + { "OpenSSH_3.2*," + "OpenSSH_3.3*," + "OpenSSH_3.4*," + "OpenSSH_3.5*," + "OpenSSH_3.6*," + "OpenSSH_3.7*," + "OpenSSH_3.8*," + "OpenSSH_3.9p1", SSH_BUG_LARGEWINDOW}, { "Sun_SSH_1.0*", SSH_BUG_NOREKEY|SSH_BUG_EXTEOF}, { "OpenSSH*", 0 }, { "*MindTerm*", 0 }, diff -u openssh-3.9p1/compat.h openssh-3.9p1-hpn/compat.h --- openssh-3.9p1/compat.h 2004-07-17 02:12:08.000000000 -0400 +++ openssh-3.9p1-hpn/compat.h 2004-09-15 01:54:43.000000000 -0400 @@ -55,6 +55,7 @@ #define SSH_BUG_EXTEOF 0x00200000 #define SSH_BUG_PROBE 0x00400000 #define SSH_BUG_FIRSTKEX 0x00800000 +#define SSH_BUG_LARGEWINDOW 0x01000000 void enable_compat13(void); void enable_compat20(void); @@ -65,4 +66,5 @@ extern int compat13; extern int compat20; extern int datafellows; + #endif Common subdirectories: openssh-3.9p1/contrib and openssh-3.9p1-hpn/contrib Common subdirectories: openssh-3.9p1/openbsd-compat and openssh-3.9p1-hpn/openbsd-compat Only in openssh-3.9p1-hpn: openssh-3.8.1p1-dynwindow5.diff Common subdirectories: openssh-3.9p1/regress and openssh-3.9p1-hpn/regress Common subdirectories: openssh-3.9p1/scard and openssh-3.9p1-hpn/scard diff -u openssh-3.9p1/serverloop.c openssh-3.9p1-hpn/serverloop.c --- openssh-3.9p1/serverloop.c 2004-08-13 07:18:01.000000000 -0400 +++ openssh-3.9p1-hpn/serverloop.c 2004-09-15 01:54:43.000000000 -0400 @@ -895,6 +895,10 @@ c = channel_new("session", SSH_CHANNEL_LARVAL, -1, -1, -1, /*window size*/0, CHAN_SES_PACKET_DEFAULT, 0, "server-session", 1); + set_unlimited(&c->input,1); + set_unlimited(&c->output,1); + if (!(datafellows & SSH_BUG_LARGEWINDOW)) + c->dynamic_window = 1; if (session_open(the_authctxt, c->self) != 1) { debug("session open failed, free channel %d", c->self); channel_free(c); Only in openssh-3.9p1-hpn: serverloop.c~ diff -u openssh-3.9p1/ssh.c openssh-3.9p1-hpn/ssh.c --- openssh-3.9p1/ssh.c 2004-08-15 03:23:34.000000000 -0400 +++ openssh-3.9p1-hpn/ssh.c 2004-09-15 01:54:43.000000000 -0400 @@ -1141,7 +1141,11 @@ "session", SSH_CHANNEL_OPENING, in, out, err, window, packetmax, CHAN_EXTENDED_WRITE, "client-session", /*nonblock*/0); - + if (!tty_flag && (!(datafellows & SSH_BUG_LARGEWINDOW))) { + c->dynamic_window = 1; + set_unlimited(&c->input,1); + set_unlimited(&c->output,1); + } debug3("ssh_session2_open: channel_new: %d", c->self); channel_send_open(c->self); Only in openssh-3.9p1-hpn: ssh.c~ diff -u openssh-3.9p1/version.h openssh-3.9p1-hpn/version.h --- openssh-3.9p1/version.h 2004-08-17 08:47:41.000000000 -0400 +++ openssh-3.9p1-hpn/version.h 2004-09-15 01:58:03.000000000 -0400 @@ -1,3 +1,3 @@ /* $OpenBSD: version.h,v 1.42 2004/08/16 08:17:01 markus Exp $ */ -#define SSH_VERSION "OpenSSH_3.9p1" +#define SSH_VERSION "OpenSSH_3.9p1-hpn" Only in openssh-3.9p1-hpn: version.h~