Mercurial > dropbear
changeset 398:59c7938af2bd
merge of '1250b8af44b62d8f4fe0f8d9fc7e7a1cc34e7e1c'
and '7f8670ac3bb975f40967f3979d09d2199b7e90c8'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 03 Feb 2007 08:20:30 +0000 |
parents | e7c1a77d2921 (diff) 5587d151d5a2 (current diff) |
children | a707e6148060 |
files | common-channel.c libtomcrypt/src/headers/ltc_tommath.h libtomcrypt/src/headers/tommath_class.h libtomcrypt/src/headers/tommath_superclass.h libtomcrypt/src/misc/mpi/is_prime.c libtomcrypt/src/misc/mpi/mpi_to_ltc_error.c libtomcrypt/src/misc/mpi/rand_prime.c libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence.c libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence.c libtomcrypt/src/pk/dh/dh.c libtomcrypt/src/pk/dh/dh_sys.c libtomcrypt/src/pk/ecc/ecc_sys.c libtomcrypt/src/pk/packet_store_header.c libtomcrypt/src/pk/packet_valid_header.c libtomcrypt/testprof/dh_tests.c libtomcrypt/testprof/test.c libtommath/TODO libtommath/logs/sqr.old svr-chansession.c |
diffstat | 2 files changed, 26 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/common-channel.c Fri Feb 02 10:11:31 2007 +0000 +++ b/common-channel.c Sat Feb 03 08:20:30 2007 +0000 @@ -181,7 +181,6 @@ struct Channel *channel; unsigned int i; - int ret; /* iterate through all the possible channels */ for (i = 0; i < ses.chansize; i++) { @@ -205,8 +204,7 @@ /* if we can read from the writefd, it might be closed, so we try to * see if it has errors */ - if (IS_DROPBEAR_SERVER && channel->writefd >= 0 - && channel->writefd != channel->readfd + if (channel->writefd >= 0 && channel->writefd != channel->readfd && FD_ISSET(channel->writefd, readfds)) { if (channel->initconn) { /* Handling for "in progress" connection - this is needed @@ -261,27 +259,27 @@ channel->writebuf, channel->writebuf ? 0 : cbuf_getused(channel->extrabuf))) - /* server chansession channels are special, since readfd mightn't - * close in the case of "sleep 4 & echo blah" until the sleep is up */ - if (channel->type->checkclose) { - if (channel->type->checkclose(channel)) { - closewritefd(channel); - closereadfd(channel, channel->readfd); - closereadfd(channel, channel->errfd); + if (!channel->sentclosed) { + + /* check for exited - currently only used for server sessions, + * if the shell has exited etc */ + if (channel->type->checkclose) { + if (channel->type->checkclose(channel)) { + closewritefd(channel); + } } - } - if (!channel->senteof - && channel->readfd == FD_CLOSED - && (channel->extrabuf != NULL || channel->errfd == FD_CLOSED)) { - send_msg_channel_eof(channel); - } + if (!channel->senteof + && channel->readfd == FD_CLOSED + && (channel->extrabuf != NULL || channel->errfd == FD_CLOSED)) { + send_msg_channel_eof(channel); + } - if (!channel->sentclosed - && channel->writefd == FD_CLOSED - && channel->readfd == FD_CLOSED - && (channel->extrabuf != NULL || channel->errfd == FD_CLOSED)) { - send_msg_channel_close(channel); + if (channel->writefd == FD_CLOSED + && channel->readfd == FD_CLOSED + && (channel->extrabuf != NULL || channel->errfd == FD_CLOSED)) { + send_msg_channel_close(channel); + } } /* When either party wishes to terminate the channel, it sends @@ -446,22 +444,20 @@ } } + /* For checking FD status (ie closure etc) - we don't actually + * read data from writefd */ TRACE(("writefd = %d, readfd %d, errfd %d, bufused %d", channel->writefd, channel->readfd, channel->errfd, cbuf_getused(channel->writebuf) )) - - /* For checking FD status (ie closure etc) - we don't actually - * read data from writefd. We don't want to do this for the client, - * since redirection to /dev/null will make it spin in the select */ - if (IS_DROPBEAR_SERVER && channel->writefd >= 0 - && channel->writefd != channel->readfd) { + if (channel->writefd >= 0 && channel->writefd != channel->readfd) { FD_SET(channel->writefd, readfds); } - /* Stuff from the wire */ + /* Stuff from the wire, to local program/shell/user etc */ if ((channel->writefd >= 0 && cbuf_getused(channel->writebuf) > 0 ) || channel->initconn) { + FD_SET(channel->writefd, writefds); }
--- a/svr-chansession.c Fri Feb 02 10:11:31 2007 +0000 +++ b/svr-chansession.c Sat Feb 03 08:20:30 2007 +0000 @@ -67,7 +67,8 @@ extern char** environ; static int sesscheckclose(struct Channel *channel) { - return channel->writefd == -1; + struct ChanSess *chansess = (struct ChanSess*)channel->typedata; + return chansess->exit.exitpid >= 0; } /* Handler for childs exiting, store the state for return to the client */