[PATCH]: Patch to fix hang on exit bug under Linux and add optional exit delay

Markus Friedl markus at openbsd.org
Thu Nov 15 21:14:24 EST 2001


On Wed, Nov 14, 2001 at 02:20:17PM -0200, Andreas Hasenack wrote:
> diff -u openssh-2.9p1/clientloop.c openssh/clientloop.c
> --- openssh-2.9p1/clientloop.c	Fri Apr 20 09:50:51 2001
> +++ openssh/clientloop.c	Mon May  7 17:10:52 2001
> @@ -840,8 +840,11 @@
>  		/* Process buffered packets sent by the server. */
>  		client_process_buffered_input_packets();
>  
> -		if (compat20 && session_closed && !channel_still_open())
> +		if (compat20 && session_closed) {
> +			if (channel_still_open())
> +				channel_stop_listening();
>  			break;
> +		}

i guess this patch is for disabling listen() for local forwarding
after the login session has been closed.

i think this matches the protocol 1 behaviour, but i have to
do some more tests.

>  		rekeying = (xxx_kex != NULL && !xxx_kex->done);
>  
> @@ -1186,6 +1189,7 @@
>  	} else if (strcmp(rtype, "exit-status") == 0) {
>  		success = 1;
>  		exit_status = packet_get_int();
> +		session_closed = 1;

well, it's possible to send data after the exit-status, so
i'm still not quite sure.

the only 'fix' for the so called hang-on-exit would be:

allow data loss in the server if a pty is allocated. i think
this would match the telnetd and rlogind behaviour best.
but i'm not 100% sure, people should test their telnetd/rlogind
servers and check that they throw away data after the login
shell dies. but once again: openssh is not telnet.

-m



More information about the openssh-unix-dev mailing list