X-Git-Url: http://andersk.mit.edu/gitweb/gssapi-openssh.git/blobdiff_plain/5156b1a1fca465f5acd9a09f208d610a64ec2ab3..d3057ca4cf3225dc431e13e2cdb7c3e8a1ee73d5:/openssh/ssh.c diff --git a/openssh/ssh.c b/openssh/ssh.c index 346f16b..3fed774 100644 --- a/openssh/ssh.c +++ b/openssh/ssh.c @@ -504,13 +504,6 @@ main(int ac, char **av) no_shell_flag = 1; no_tty_flag = 1; break; - case 'T': - no_tty_flag = 1; - /* ensure that the user doesn't try to backdoor a */ - /* null cipher switch on an interactive session */ - /* so explicitly disable it no matter what */ - options.none_switch=0; - break; case 'o': dummy = 1; line = xstrdup(optarg); @@ -519,6 +512,13 @@ main(int ac, char **av) exit(255); xfree(line); break; + case 'T': + no_tty_flag = 1; + /* ensure that the user doesn't try to backdoor a */ + /* null cipher switch on an interactive session */ + /* so explicitly disable it no matter what */ + options.none_switch=0; + break; case 's': subsystem_flag = 1; break; @@ -922,8 +922,7 @@ ssh_init_forwarding(void) options.local_forwards[i].listen_port, options.local_forwards[i].connect_host, options.local_forwards[i].connect_port, - options.gateway_ports, options.hpn_disabled, - options.hpn_buffer_size); + options.gateway_ports); } if (i > 0 && success != i && options.exit_on_forward_failure) fatal("Could not request local forwarding."); @@ -1217,43 +1216,46 @@ ssh_session2_open(void) /* to no. In which case we *can* just set the window to the */ /* minimum of the hpn buffer size and tcp receive buffer size */ - if(options.hpn_disabled) - { + if (tty_flag) options.hpn_buffer_size = CHAN_SES_WINDOW_DEFAULT; - } - else if (datafellows & SSH_BUG_LARGEWINDOW) + else + options.hpn_buffer_size = 2*1024*1024; + + if (datafellows & SSH_BUG_LARGEWINDOW) { debug("HPN to Non-HPN Connection"); - if (options.hpn_buffer_size < 0) - options.hpn_buffer_size = 2*1024*1024; } else { - if (options.hpn_buffer_size < 0) - options.hpn_buffer_size = BUFFER_MAX_LEN_HPN; - - /*create a socket but don't connect it */ - /* we use that the get the rcv socket size */ - sock = socket(AF_INET, SOCK_STREAM, 0); - /* if they are using the tcp_rcv_buf option */ - /* attempt to set the buffer size to that */ - if (options.tcp_rcv_buf) - setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void *)&options.tcp_rcv_buf, - sizeof(options.tcp_rcv_buf)); - getsockopt(sock, SOL_SOCKET, SO_RCVBUF, - &socksize, &socksizelen); - close(sock); - debug("socksize %d", socksize); if (options.tcp_rcv_buf_poll <= 0) { - options.hpn_buffer_size = MIN(socksize,options.hpn_buffer_size); - debug ("MIN of TCP RWIN and HPNBufferSize: %d", options.hpn_buffer_size); + sock = socket(AF_INET, SOCK_STREAM, 0); + getsockopt(sock, SOL_SOCKET, SO_RCVBUF, + &socksize, &socksizelen); + close(sock); + debug("socksize %d", socksize); + options.hpn_buffer_size = socksize; + debug ("HPNBufferSize set to TCP RWIN: %d", options.hpn_buffer_size); } else { if (options.tcp_rcv_buf > 0) - options.hpn_buffer_size = MIN(options.tcp_rcv_buf, options.hpn_buffer_size); - debug ("MIN of TCPRcvBuf and HPNBufferSize: %d", options.hpn_buffer_size); + { + /*create a socket but don't connect it */ + /* we use that the get the rcv socket size */ + sock = socket(AF_INET, SOCK_STREAM, 0); + /* if they are using the tcp_rcv_buf option */ + /* attempt to set the buffer size to that */ + if (options.tcp_rcv_buf) + setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void *)&options.tcp_rcv_buf, + sizeof(options.tcp_rcv_buf)); + getsockopt(sock, SOL_SOCKET, SO_RCVBUF, + &socksize, &socksizelen); + close(sock); + debug("socksize %d", socksize); + options.hpn_buffer_size = socksize; + debug ("HPNBufferSize set to user TCPRcvBuf: %d", options.hpn_buffer_size); + } } } @@ -1262,6 +1264,8 @@ ssh_session2_open(void) window = options.hpn_buffer_size; + channel_set_hpn(options.hpn_disabled, options.hpn_buffer_size); + packetmax = CHAN_SES_PACKET_DEFAULT; if (tty_flag) { window = 4*CHAN_SES_PACKET_DEFAULT; @@ -1272,7 +1276,6 @@ ssh_session2_open(void) "session", SSH_CHANNEL_OPENING, in, out, err, window, packetmax, CHAN_EXTENDED_WRITE, "client-session", /*nonblock*/0); - if ((options.tcp_rcv_buf_poll > 0) && (!options.hpn_disabled)) { c->dynamic_window = 1; debug ("Enabled Dynamic Window Scaling\n");