]> andersk Git - gssapi-openssh.git/blobdiff - openssh/serverloop.c
Tweak the environment variables set by the configure script for the
[gssapi-openssh.git] / openssh / serverloop.c
index 731950e3db42134b45b539e3ea84c8fa8a232319..289f806a39c5438d8621c86aab160f374ad3aad3 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: serverloop.c,v 1.144 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: serverloop.c,v 1.145 2006/10/11 12:38:03 markus Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -248,8 +248,10 @@ client_alive_check(void)
        int channel_id;
 
        /* timeout, check to see how many we have had */
-       if (++client_alive_timeouts > options.client_alive_count_max)
-               packet_disconnect("Timeout, your session not responding.");
+       if (++client_alive_timeouts > options.client_alive_count_max) {
+               logit("Timeout, client not responding.");
+               cleanup_exit(255);
+       }
 
        /*
         * send a bogus global/channel request with "wantreply",
@@ -278,6 +280,7 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
        struct timeval tv, *tvp;
        int ret;
        int client_alive_scheduled = 0;
+       int program_alive_scheduled = 0;
 
        /*
         * if using client_alive, set the max timeout accordingly,
@@ -315,6 +318,7 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
                 * the client, try to get some more data from the program.
                 */
                if (packet_not_very_much_data_to_write()) {
+                       program_alive_scheduled = child_terminated;
                        if (!fdout_eof)
                                FD_SET(fdout, *readsetp);
                        if (!fderr_eof)
@@ -360,8 +364,16 @@ wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp,
                memset(*writesetp, 0, *nallocp);
                if (errno != EINTR)
                        error("select: %.100s", strerror(errno));
-       } else if (ret == 0 && client_alive_scheduled)
-               client_alive_check();
+       } else {
+               if (ret == 0 && client_alive_scheduled)
+                       client_alive_check();
+               if (!compat20 && program_alive_scheduled && fdin_is_tty) {
+                       if (!fdout_eof)
+                               FD_SET(fdout, *readsetp);
+                       if (!fderr_eof)
+                               FD_SET(fderr, *readsetp);
+               }
+       }
 
        notify_done(*readsetp);
 }
@@ -405,7 +417,8 @@ process_input(fd_set *readset)
        if (!fdout_eof && FD_ISSET(fdout, readset)) {
                errno = 0;
                len = read(fdout, buf, sizeof(buf));
-               if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
+               if (len < 0 && (errno == EINTR ||
+                   (errno == EAGAIN && !child_terminated))) {
                        /* do nothing */
 #ifndef PTY_ZEROREAD
                } else if (len <= 0) {
@@ -423,7 +436,8 @@ process_input(fd_set *readset)
        if (!fderr_eof && FD_ISSET(fderr, readset)) {
                errno = 0;
                len = read(fderr, buf, sizeof(buf));
-               if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
+               if (len < 0 && (errno == EINTR ||
+                   (errno == EAGAIN && !child_terminated))) {
                        /* do nothing */
 #ifndef PTY_ZEROREAD
                } else if (len <= 0) {
@@ -944,9 +958,9 @@ server_request_direct_tcpip(void)
        if (sock < 0)
                return NULL;
        if (options.hpn_disabled)
-               c = channel_new("direct-tcpip", SSH_CHANNEL_CONNECTING,
-                   sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT,
-                   CHAN_TCP_PACKET_DEFAULT, 0, "direct-tcpip", 1);
+       c = channel_new("direct-tcpip", SSH_CHANNEL_CONNECTING,
+           sock, sock, -1, CHAN_TCP_WINDOW_DEFAULT,
+           CHAN_TCP_PACKET_DEFAULT, 0, "direct-tcpip", 1);
        else
                c = channel_new("direct-tcpip", SSH_CHANNEL_CONNECTING,
                    sock, sock, -1, options.hpn_buffer_size,
@@ -986,8 +1000,8 @@ server_request_tun(void)
        if (sock < 0)
                goto done;
        if (options.hpn_disabled)
-               c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1,
-                   CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
+       c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1,
+           CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
        else
                c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1,
                    options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
This page took 0.036844 seconds and 4 git commands to generate.