[serverloop.c]
     keep the ssh session even if there is no active channel.
     this is more in line with the protocol spec and makes
        ssh -N -L 1234:server:110 host
     more useful.
     based on discussion with <mats@mindbright.se> long time ago
     and recent mail from <res@shore.net>
This commit is contained in:
Ben Lindstrom 2001-04-07 01:12:11 +00:00
parent 8248d116c4
commit e34ab4c04e
2 changed files with 19 additions and 10 deletions

View File

@ -1,5 +1,14 @@
20010407
- (bal) CVS ID Resync of version.h
- OpenBSD CVS Sync
- markus@cvs.openbsd.org 2001/04/05 23:39:20
[serverloop.c]
keep the ssh session even if there is no active channel.
this is more in line with the protocol spec and makes
ssh -N -L 1234:server:110 host
more useful.
based on discussion with <mats@mindbright.se> long time ago
and recent mail from <res@shore.net>
20010406
- (stevesk) logintest.c: fix for systems without __progname
@ -4911,4 +4920,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.1075 2001/04/07 01:08:46 mouring Exp $
$Id: ChangeLog,v 1.1076 2001/04/07 01:12:11 mouring Exp $

View File

@ -35,7 +35,7 @@
*/
#include "includes.h"
RCSID("$OpenBSD: serverloop.c,v 1.59 2001/04/05 10:42:51 markus Exp $");
RCSID("$OpenBSD: serverloop.c,v 1.60 2001/04/05 23:39:20 markus Exp $");
#include "xmalloc.h"
#include "packet.h"
@ -77,7 +77,8 @@ static int fderr_eof = 0; /* EOF encountered readung from fderr. */
static int fdin_is_tty = 0; /* fdin points to a tty. */
static int connection_in; /* Connection to client (input). */
static int connection_out; /* Connection to client (output). */
static u_int buffer_high;/* "Soft" max buffer size. */
static int connection_closed = 0; /* Connection to client closed. */
static u_int buffer_high; /* "Soft" max buffer size. */
/*
* This SIGCHLD kludge is used to detect when the child exits. The server
@ -277,6 +278,9 @@ process_input(fd_set * readset)
len = read(connection_in, buf, sizeof(buf));
if (len == 0) {
verbose("Connection closed by remote host.");
connection_closed = 1;
if (compat20)
return;
fatal_cleanup();
} else if (len < 0) {
if (errno != EINTR && errno != EAGAIN) {
@ -650,7 +654,7 @@ void
server_loop2(void)
{
fd_set *readset = NULL, *writeset = NULL;
int had_channel = 0, rekeying = 0, max_fd, status;
int rekeying = 0, max_fd, status;
pid_t pid;
debug("Entering interactive session for SSH2.");
@ -669,12 +673,6 @@ server_loop2(void)
rekeying = (xxx_kex != NULL && !xxx_kex->done);
if (!had_channel && channel_still_open())
had_channel = 1;
if (had_channel && !channel_still_open()) {
debug("!channel_still_open.");
break;
}
if (!rekeying && packet_not_very_much_data_to_write())
channel_output_poll();
wait_until_can_do_something(&readset, &writeset, &max_fd,
@ -687,6 +685,8 @@ server_loop2(void)
if (!rekeying)
channel_after_select(readset, writeset);
process_input(readset);
if (connection_closed)
break;
process_output(writeset);
}
if (readset)