Why openssh newer than 2.9.9 doesn't send SIGTERM and SIGHUP to child process?

Markus Friedl markus at openbsd.org
Fri Oct 11 21:08:49 EST 2002


because it was wrong (telnetd, rlogind don't do it)
and dangerous (sending signals as root to other processes).

the login shells should die if their stdin/out is closed.

did you check the cvs log for this change?

On Fri, Oct 11, 2002 at 12:44:46PM +0200, Petr Ostadal wrote:
> Hi,
> 
> I search in archive list if there any reason why is removed in openssh
> newer than 2.9.9 from function
> 'void session_close_by_channel(int id, void *arg)' sending of SIGTEMR and
> SIGHUP signals to child as was in 2.9.9 version?  See follow sniped code
> from 2.9.9 sources:
> 
> ---- openssh-2.9.9/session.c ----------------------------------------
> void
> session_close_by_channel(int id, void *arg)
> 	...
>         debug("session_close_by_channel: channel %d kill %d", id, s->pid);
>         if (s->pid == 0) {
>                 /* close session immediately */
>                 session_close(s);
>         } else {
>                 /* notify child, delay session cleanup */
>                 if (kill(s->pid, (s->ttyfd == -1) ? SIGTERM : SIGHUP) < 0)
> 		^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                         error("session_close_by_channel: kill %d: %s",
>                             s->pid, strerror(errno));
>         }
>     	...
> 
> ----------------------------------------------------------------------------
> 
> This change in new version cause that some process (which doesn't need
> terminal) hanged after termination ssh by e.g. SIGINT, becouse hanged
> process doesn't receive any signal from ssh process.
> 
> basilisk:~> ssh basilisk 'sleep 1000'
> 23022: Killed by signal 2.
> basilisk:~> ps -ef |grep sleep
> postadal 23026     1  1 12:30 ?        00:00:00 sleep 100
> 
> The problem above can resolve Force pseudo-tty allocation (option -t), but
> it is not  ideal solution.
> 
> Please, could anyone tell me why the new openssh doesn't send SIGHUP to
> child process if ssh was terminated ?
> 
> 	Thnx in advance
> 
> 		Petr
> 
> --
> Best Regards / S pozdravem,
> 
> Petr Ostadal
> developer
> ---------------------------------------------------------------------
> SuSE CR, s.r.o. 			e-mail: postadal at suse.cz
> Drahobejlova 27 			tel:	+420 2 9654 2382
> 190 00 Praha 9 				fax:	+420 2 9654 2374
> Czech Republic 				http://www.suse.cz
> 
> _______________________________________________
> openssh-unix-dev at mindrot.org mailing list
> http://www.mindrot.org/mailman/listinfo/openssh-unix-dev



More information about the openssh-unix-dev mailing list