]> andersk Git - openssh.git/blobdiff - nchan.c
- (djm) Stop shadow expiry checking from preventing logins with NIS. Based
[openssh.git] / nchan.c
diff --git a/nchan.c b/nchan.c
index b4a085f16e91ca7172054093ad81eeb6e1b26e1a..cef56497bc1b29b428002845c114900e3857343a 100644 (file)
--- a/nchan.c
+++ b/nchan.c
@@ -28,7 +28,7 @@
  */
 
 #include "includes.h"
-RCSID("$Id$");
+RCSID("$OpenBSD: nchan.c,v 1.18 2000/06/20 01:39:42 markus Exp $");
 
 #include "ssh.h"
 
@@ -107,6 +107,10 @@ chan_read_failed_12(Channel *c)
                debug("channel %d: input open -> drain", c->self);
                chan_shutdown_read(c);
                c->istate = CHAN_INPUT_WAIT_DRAIN;
+               if (buffer_len(&c->input) == 0) {
+                       debug("channel %d: input: no drain shortcut", c->self);
+                       chan_ibuf_empty(c);
+               }
                break;
        default:
                error("channel %d: internal error: we do not read, but chan_read_failed for istate %d",
@@ -139,6 +143,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);
@@ -314,7 +337,7 @@ chan_write_failed2(Channel *c)
        switch (c->ostate) {
        case CHAN_OUTPUT_OPEN:
                debug("channel %d: output open -> closed", c->self);
-               chan_shutdown_write(c); // ??
+               chan_shutdown_write(c); /* ?? */
                c->ostate = CHAN_OUTPUT_CLOSED;
                break;
        case CHAN_OUTPUT_WAIT_DRAIN:
@@ -389,11 +412,11 @@ chan_delete_if_full_closed2(Channel *c)
                if (!(c->flags & CHAN_CLOSE_SENT)) {
                        chan_send_close2(c);
                }
-               if ((c->flags & CHAN_CLOSE_SENT) && 
+               if ((c->flags & CHAN_CLOSE_SENT) &&
                    (c->flags & CHAN_CLOSE_RCVD)) {
                        debug("channel %d: full closed2", c->self);
                        channel_free(c->self);
-               } 
+               }
        }
 }
 
This page took 0.039153 seconds and 4 git commands to generate.