[openssh] Re: SNAP-2000082900

Markus Friedl markus.friedl at informatik.uni-erlangen.de
Thu Aug 31 09:25:51 EST 2000


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) {
> 
> 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
> 
> 





More information about the openssh-unix-dev mailing list