]> andersk Git - gssapi-openssh.git/blobdiff - openssh/clientloop.c
http://www.psc.edu/networking/projects/hpn-ssh/openssh-4.5p1-hpn12v14.diff.gz
[gssapi-openssh.git] / openssh / clientloop.c
index 4c5108199c96000cb9f4179b79392625d3cf1869..2f7ce2b51e86b7a31e27c53829b787ad2ebbc5e1 100644 (file)
@@ -715,6 +715,10 @@ client_process_control(fd_set *readset)
        u_int i, len, env_len, command, flags;
        uid_t euid;
        gid_t egid;
+       int listen_port = 0;
+       int connect_port = 0;
+       char * listen_host = NULL;
+       char * connect_host = NULL;
 
        /*
         * Accept connection on control socket
@@ -763,6 +767,13 @@ client_process_control(fd_set *readset)
        command = buffer_get_int(&m);
        flags = buffer_get_int(&m);
 
+       if (SSHMUX_FLAG_PORTFORWARD & flags)
+       {
+               listen_host = buffer_get_string(&m,NULL);
+               listen_port = buffer_get_int(&m);
+               connect_host = buffer_get_string(&m,NULL);
+               connect_port = buffer_get_int(&m);
+       }
        buffer_clear(&m);
 
        switch (command) {
@@ -802,6 +813,31 @@ client_process_control(fd_set *readset)
                return;
        }
 
+       if (allowed && (SSHMUX_FLAG_PORTFORWARD & flags) && listen_host && connect_host)
+       {
+               int ret;
+               Forward * fwd;
+
+               fwd = &options.local_forwards[options.num_local_forwards++];
+               fwd->listen_host = xstrdup(listen_host);
+               fwd->listen_port = listen_port;
+               fwd->connect_host = xstrdup(connect_host);
+               fwd->connect_port = connect_port;
+               ret = channel_setup_local_fwd_listener(
+                       options.local_forwards[options.num_local_forwards-1].listen_host,
+                       options.local_forwards[options.num_local_forwards-1].listen_port,
+                       options.local_forwards[options.num_local_forwards-1].connect_host,
+                       options.local_forwards[options.num_local_forwards-1].connect_port,
+                        options.gateway_ports, options.hpn_disabled, options.hpn_buffer_size);
+
+        }
+
+       
+       if (listen_host)
+               xfree(listen_host);
+       if (connect_host)
+               xfree(connect_host);
+
        /* Reply for SSHMUX_COMMAND_OPEN */
        buffer_clear(&m);
        buffer_put_int(&m, allowed);
@@ -900,11 +936,16 @@ client_process_control(fd_set *readset)
 
        set_nonblock(client_fd);
 
-       c = channel_new("session", SSH_CHANNEL_OPENING,
-           new_fd[0], new_fd[1], new_fd[2],
-           CHAN_SES_WINDOW_DEFAULT, CHAN_SES_PACKET_DEFAULT,
-           CHAN_EXTENDED_WRITE, "client-session", /*nonblock*/0);
-
+       if (options.hpn_disabled) 
+               c = channel_new("session", SSH_CHANNEL_OPENING,
+                   new_fd[0], new_fd[1], new_fd[2],
+                   CHAN_SES_WINDOW_DEFAULT, CHAN_SES_PACKET_DEFAULT,
+                   CHAN_EXTENDED_WRITE, "client-session", /*nonblock*/0);
+       else 
+               c = channel_new("session", SSH_CHANNEL_OPENING,
+                   new_fd[0], new_fd[1], new_fd[2],
+                   options.hpn_buffer_size, CHAN_SES_PACKET_DEFAULT,
+                   CHAN_EXTENDED_WRITE, "client-session", /*nonblock*/0);
        /* XXX */
        c->ctl_fd = client_fd;
 
@@ -1003,7 +1044,8 @@ process_cmdline(void)
                if (local) {
                        if (channel_setup_local_fwd_listener(fwd.listen_host,
                            fwd.listen_port, fwd.connect_host,
-                           fwd.connect_port, options.gateway_ports) < 0) {
+                           fwd.connect_port, options.gateway_ports, 
+                           options.hpn_disabled, options.hpn_buffer_size) < 0) {
                                logit("Port forwarding failed.");
                                goto out;
                        }
@@ -1702,10 +1744,16 @@ client_request_forwarded_tcpip(const char *request_type, int rchan)
                xfree(listen_address);
                return NULL;
        }
-       c = channel_new("forwarded-tcpip",
-           SSH_CHANNEL_CONNECTING, sock, sock, -1,
-           CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
-           originator_address, 1);
+       if (options.hpn_disabled) 
+               c = channel_new("forwarded-tcpip",
+                   SSH_CHANNEL_CONNECTING, sock, sock, -1,
+                   CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
+                   originator_address, 1);
+       else
+               c = channel_new("forwarded-tcpip",
+                   SSH_CHANNEL_CONNECTING, sock, sock, -1,
+                   options.hpn_buffer_size, options.hpn_buffer_size, 0,
+                   originator_address, 1);
        xfree(originator_address);
        xfree(listen_address);
        return c;
@@ -1739,9 +1787,14 @@ client_request_x11(const char *request_type, int rchan)
        sock = x11_connect_display();
        if (sock < 0)
                return NULL;
-       c = channel_new("x11",
-           SSH_CHANNEL_X11_OPEN, sock, sock, -1,
-           CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
+       if (options.hpn_disabled) 
+               c = channel_new("x11",
+                   SSH_CHANNEL_X11_OPEN, sock, sock, -1,
+                   CHAN_TCP_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
+       else 
+               c = channel_new("x11",
+                   SSH_CHANNEL_X11_OPEN, sock, sock, -1,
+                   options.hpn_buffer_size, CHAN_X11_PACKET_DEFAULT, 0, "x11", 1);
        c->force_drain = 1;
        return c;
 }
@@ -1760,10 +1813,16 @@ client_request_agent(const char *request_type, int rchan)
        sock =  ssh_get_authentication_socket();
        if (sock < 0)
                return NULL;
-       c = channel_new("authentication agent connection",
-           SSH_CHANNEL_OPEN, sock, sock, -1,
-           CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
-           "authentication agent connection", 1);
+       if (options.hpn_disabled) 
+               c = channel_new("authentication agent connection",
+                   SSH_CHANNEL_OPEN, sock, sock, -1,
+                   CHAN_X11_WINDOW_DEFAULT, CHAN_TCP_WINDOW_DEFAULT, 0,
+                   "authentication agent connection", 1);
+       else
+               c = channel_new("authentication agent connection",
+                   SSH_CHANNEL_OPEN, sock, sock, -1,
+                   options.hpn_buffer_size, options.hpn_buffer_size, 0,
+                   "authentication agent connection", 1);
        c->force_drain = 1;
        return c;
 }
This page took 0.449775 seconds and 4 git commands to generate.