]> andersk Git - openssh.git/blobdiff - clientloop.c
- dtucker@cvs.openbsd.org 2010/01/08 21:50:49
[openssh.git] / clientloop.c
index 43f001bc4b28ad0ee7dbfc2f66eae0a2f1cb6245..eca87777f95102cbe471d2731eb557077a48270c 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.212 2009/05/28 16:50:16 andreas Exp $ */
+/* $OpenBSD: clientloop.c,v 1.215 2009/11/17 05:31:44 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -161,6 +161,8 @@ static int session_closed = 0;      /* In SSH2: login session closed. */
 static void client_init_dispatch(void);
 int    session_ident = -1;
 
+int    session_resumed = 0;
+
 /* Track escape per proto2 channel */
 struct escape_filter_ctx {
        int escape_pending;
@@ -636,7 +638,7 @@ static void
 client_process_net_input(fd_set *readset)
 {
        int len, cont = 0;
-       char buf[8192];
+       char buf[SSH_IOBUFSZ];
 
        /*
         * Read input from the server, and add any such data to the buffer of
@@ -1129,7 +1131,7 @@ static void
 client_process_input(fd_set *readset)
 {
        int len;
-       char buf[8192];
+       char buf[SSH_IOBUFSZ];
 
        /* Read input from stdin. */
        if (FD_ISSET(fileno(stdin), readset)) {
@@ -1460,6 +1462,14 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
                        client_process_output(writeset);
                }
 
+               if (session_resumed) {
+                       connection_in = packet_get_connection_in();
+                       connection_out = packet_get_connection_out();
+                       max_fd = MAX(max_fd, connection_out);
+                       max_fd = MAX(max_fd, connection_in);
+                       session_resumed = 0;
+               }
+
                /*
                 * Send as much buffered packet data as possible to the
                 * sender.
@@ -1477,11 +1487,13 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
        /* Stop watching for window change. */
        signal(SIGWINCH, SIG_DFL);
 
-       packet_start(SSH2_MSG_DISCONNECT);
-       packet_put_int(SSH2_DISCONNECT_BY_APPLICATION);
-       packet_put_cstring("disconnected by user");
-       packet_send();
-       packet_write_wait();
+       if (compat20) {
+               packet_start(SSH2_MSG_DISCONNECT);
+               packet_put_int(SSH2_DISCONNECT_BY_APPLICATION);
+               packet_put_cstring("disconnected by user");
+               packet_send();
+               packet_write_wait();
+       }
 
        channel_free_all();
 
@@ -1844,15 +1856,17 @@ client_input_channel_req(int type, u_int32_t seq, void *ctxt)
                chan_rcvd_eow(c);
        } else if (strcmp(rtype, "exit-status") == 0) {
                exitval = packet_get_int();
-               if (id == session_ident) {
+               if (c->ctl_fd != -1) {
+                       /* Dispatch to mux client */
+                       atomicio(vwrite, c->ctl_fd, &exitval, sizeof(exitval));
+                       success = 1;
+               } else if (id == session_ident) {
+                       /* Record exit value of local session */
                        success = 1;
                        exit_status = exitval;
-               } else if (c->ctl_fd == -1) {
+               } else {
                        error("client_input_channel_req: unexpected channel %d",
                            session_ident);
-               } else {
-                       atomicio(vwrite, c->ctl_fd, &exitval, sizeof(exitval));
-                       success = 1;
                }
                packet_check_eom();
        }
This page took 1.823392 seconds and 4 git commands to generate.