OpenSSH
[Top] [All Lists]

Re: 4.6p1 chan_read_failed error

To: Jim Stosick <jws@lindy.stanford.edu>
Subject: Re: 4.6p1 chan_read_failed error
From: Damien Miller <djm@mindrot.org>
Date: Mon, 9 Apr 2007 08:46:56 +1000 (EST)
Cc: openssh-unix-dev@mindrot.org
Delivered-to: sp-com-lists@consult.net
Delivered-to: openssh-unix-dev-list1@securepoint.com
Delivered-to: openssh-unix-dev-tmda@mindrot.org
Delivered-to: openssh-unix-dev@mindrot.org
In-reply-to: <Pine.BSO.4.64.0704041358330.26831@fuyu.mindrot.org>
List-archive: <http://lists.mindrot.org/pipermail/openssh-unix-dev>
List-help: <mailto:openssh-unix-dev-request@mindrot.org?subject=help>
List-id: Development of portable OpenSSH <openssh-unix-dev.mindrot.org>
List-post: <mailto:openssh-unix-dev@mindrot.org>
List-subscribe: <http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev>, <mailto:openssh-unix-dev-request@mindrot.org?subject=subscribe>
List-unsubscribe: <http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev>, <mailto:openssh-unix-dev-request@mindrot.org?subject=unsubscribe>
References: <46045AB6.6050903@lindy.stanford.edu> <20070324114902.GA8307@gate.dtucker.net> <46084BAF.2070601@lindy.stanford.edu> <Pine.BSO.4.64.0704041358330.26831@fuyu.mindrot.org>
Sender: openssh-unix-dev-bounces+openssh-unix-dev-list1=securepoint.com@mindrot.org
On Wed, 4 Apr 2007, Damien Miller wrote:

> Well, it also undoes the fix for bug #52. I think it is safe to simply hush
> the error message:

ugh, the logic in that patch was almost, but not completely, wrong. Please
try this one instead:

Index: channels.c
===================================================================
RCS file: /var/cvs/openssh/channels.c,v
retrieving revision 1.251
diff -u -p -r1.251 channels.c
--- channels.c  28 Jan 2007 23:16:28 -0000      1.251
+++ channels.c  8 Apr 2007 22:43:25 -0000
@@ -932,7 +932,7 @@ channel_pre_x11_open(Channel *c, fd_set 
        } else if (ret == -1) {
                logit("X11 connection rejected because of wrong 
authentication.");
                debug2("X11 rejected %d i%d/o%d", c->self, c->istate, 
c->ostate);
-               chan_read_failed(c);
+               chan_read_failed(c, 0);
                buffer_clear(&c->input);
                chan_ibuf_empty(c);
                buffer_clear(&c->output);
@@ -1472,14 +1472,15 @@ channel_handle_rfd(Channel *c, fd_set *r
                                c->type = SSH_CHANNEL_INPUT_DRAINING;
                                debug2("channel %d: input draining.", c->self);
                        } else {
-                               chan_read_failed(c);
+                               chan_read_failed(c, (errno == EAGAIN &&
+                                   !(c->isatty && c->detach_close)));
                        }
                        return -1;
                }
                if (c->input_filter != NULL) {
                        if (c->input_filter(c, buf, len) == -1) {
                                debug2("channel %d: filter stops", c->self);
-                               chan_read_failed(c);
+                               chan_read_failed(c, 0);
                        }
                } else if (c->datagram) {
                        buffer_put_string(&c->input, buf, len);
@@ -1643,7 +1644,7 @@ channel_handle_ctl(Channel *c, fd_set *r
                                chan_mark_dead(c);
                                return -1;
                        } else {
-                               chan_read_failed(c);
+                               chan_read_failed(c, 0);
                                chan_write_failed(c);
                        }
                        return -1;
Index: channels.h
===================================================================
RCS file: /var/cvs/openssh/channels.h,v
retrieving revision 1.81
diff -u -p -r1.81 channels.h
--- channels.h  5 Aug 2006 02:39:39 -0000       1.81
+++ channels.h  8 Apr 2007 22:43:41 -0000
@@ -240,7 +240,7 @@ void         chan_mark_dead(Channel *);
 /* channel events */
 
 void    chan_rcvd_oclose(Channel *);
-void    chan_read_failed(Channel *);
+void    chan_read_failed(Channel *, int);
 void    chan_ibuf_empty(Channel *);
 
 void    chan_rcvd_ieof(Channel *);
Index: nchan.c
===================================================================
RCS file: /var/cvs/openssh/nchan.c,v
retrieving revision 1.56
diff -u -p -r1.56 nchan.c
--- nchan.c     5 Aug 2006 02:39:40 -0000       1.56
+++ nchan.c     8 Apr 2007 22:41:36 -0000
@@ -133,17 +133,19 @@ chan_rcvd_oclose1(Channel *c)
        }
 }
 void
-chan_read_failed(Channel *c)
+chan_read_failed(Channel *c, int simulated)
 {
-       debug2("channel %d: read failed", c->self);
+       debug2("channel %d: read failed%s, istate %d", c->self,
+           simulated ? " (simulated)" : "", c->istate);
        switch (c->istate) {
        case CHAN_INPUT_OPEN:
                chan_shutdown_read(c);
                chan_set_istate(c, CHAN_INPUT_WAIT_DRAIN);
                break;
        default:
-               error("channel %d: chan_read_failed for istate %d",
-                   c->self, c->istate);
+               if (!simulated)
+                       error("channel %d: chan_read_failed for istate %d",
+                           c->self, c->istate);
                break;
        }
 }
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

<Prev in Thread] Current Thread [Next in Thread>