summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2000-05-03 10:19:19 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2000-05-03 10:19:19 +0000
commit54a3a9878ba48a5076938697cf92b15045369153 (patch)
tree2b14b3f5658de0848ba3afdb6eafb99ba0911a52 /usr.bin
parente3fe3bee7a70221f6467817d157466c9902b3cad (diff)
fix close for non-open ssh1 channels
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/nchan.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/ssh/nchan.c b/usr.bin/ssh/nchan.c
index 3d4313a37a5..383db290fe9 100644
--- a/usr.bin/ssh/nchan.c
+++ b/usr.bin/ssh/nchan.c
@@ -28,7 +28,7 @@
*/
#include "includes.h"
-RCSID("$Id: nchan.c,v 1.15 2000/05/02 12:44:38 markus Exp $");
+RCSID("$Id: nchan.c,v 1.16 2000/05/03 10:19:18 markus Exp $");
#include "ssh.h"
@@ -139,6 +139,25 @@ static void
chan_rcvd_ieof1(Channel *c)
{
debug("channel %d: rcvd ieof", c->self);
+ if (c->type != SSH_CHANNEL_OPEN) {
+ debug("channel %d: non-open", c->self);
+ if (c->istate == CHAN_INPUT_OPEN) {
+ debug("channel %d: non-open: input open -> wait_oclose", c->self);
+ chan_shutdown_read(c);
+ chan_send_ieof1(c);
+ c->istate = CHAN_INPUT_WAIT_OCLOSE;
+ } else {
+ error("channel %d: istate %d != open", c->self, c->istate);
+ }
+ if (c->ostate == CHAN_OUTPUT_OPEN) {
+ debug("channel %d: non-open: output open -> closed", c->self);
+ chan_send_oclose1(c);
+ c->ostate = CHAN_OUTPUT_CLOSED;
+ } else {
+ error("channel %d: ostate %d != open", c->self, c->ostate);
+ }
+ return;
+ }
switch (c->ostate) {
case CHAN_OUTPUT_OPEN:
debug("channel %d: output open -> drain", c->self);