[openssh] Re: [openssh] Re: SNAP-2000082900

Tobias Oetiker oetiker at ee.ethz.ch
Thu Aug 31 16:34:00 EST 2000


Today you sent me mail regarding [openssh] Re: [openssh] Re: SNAP-2000082900:

*> i think the server should
*> signal(SIGPIPE, SIG_IGN) in serverloop.c/server_loop{2}(), or
*> earlier and restore the default
*> signal(SIGPIPE, SIG_DFL) in sshd.c after the child is fork'ed.
*> 
*> On Wed, Aug 30, 2000 at 08:22:20AM +0200, Tobias Oetiker wrote:
*> > OK ... this issue is realy getting to me ... so I debugged it ... 
*> > here is the patch ... the problem seems to be that the motif app
*> > exists so fast that it is already gone when sshd still tries to
*> > send data to the remote xserver or something of that ilk ... 
*> > probably the error is somewhere deeper inside the x11 forwarding
*> > code as I expect the remote ssh should actually tell the sshd that
*> > a channel has been closed ... 
*> > 
*> > --- channels.c.orig     Wed Aug 30 07:42:11 2000
*> > +++ channels.c  Wed Aug 30 08:09:30 2000
*> > @@ -686,9 +686,17 @@
*> >         if (c->wfd != -1 &&
*> >             FD_ISSET(c->wfd, writeset) &&
*> >             buffer_len(&c->output) > 0) {
*> > +               void *oldhandler;
*> > +               int errsave;
*> > +               /* maybe the other end is dead so we would get SIGPIPE
*> > +                  which would be fatal. We don't want this, so lets
*> > +                  ignore it for now and reset the handler afterwards */
*> > +                oldhandler = signal (SIGPIPE, SIG_IGN);
*> >                 len = write(c->wfd, buffer_ptr(&c->output),
*> >                     buffer_len(&c->output));
*> > -               if (len < 0 && (errno == EINTR || errno == EAGAIN))
*> > +                errsave = errno;
*> > +                       signal (SIGPIPE, oldhandler);
*> > +               if (len < 0 && (errsave == EINTR || errsave == EAGAIN || errsave==EPIPE))
*> >                         return 1;
*> >                 if (len <= 0) {
*> >                         if (compat13) {

As mentioned above I have been thinking about why this could happen
at all. Here is my theory. Uppon exit, the application (or sshd x11 forwarding
code) somehow removes its session from the remote Xserver or remote
ssh (maybe this is done differently by motif apps than
other toolkits) the remote server complies with the wish of the app
and closes the session. Then the sshd end wants to send some more
data. Often this works because the session has not been closed yet,
but sometimes the remote session is gone already and therfore sshd
gets sigpipe. Obviously sshd must not die upon this event and
should thus ignore sigpipe. But I suspect that the event should not
occur at all under these circumstances ... 

cheers
tobi
*>
>
*> > cheers
*> > tobi
*> > 
*> > -- 
*> >  ______    __   _
*> > /_  __/_  / /  (_) Oetiker, Timelord & SysMgr @ EE-Dept ETH-Zurich
*> >  / // _ \/ _ \/ / TEL: +41(0)1-6325286  FAX:...1517  ICQ: 10419518 
*> > /_/ \.__/_.__/_/ oetiker at ee.ethz.ch http://ee-staff.ethz.ch/~oetiker
*> > 
*> > 
*> 
*> 

-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker, Timelord & SysMgr @ EE-Dept ETH-Zurich
 / // _ \/ _ \/ / TEL: +41(0)1-6325286  FAX:...1517  ICQ: 10419518 
/_/ \.__/_.__/_/ oetiker at ee.ethz.ch http://ee-staff.ethz.ch/~oetiker






More information about the openssh-unix-dev mailing list