From bf61af1919f22775a0a3e272893a26499feacf23 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 3 Oct 2018 20:55:01 +0100 Subject: [PATCH] ssh2 conn: don't set mainchan_eof_sent when we didn't. In mainchan_send_eof, which is the Channel method that gets called when EOF has been received from the SSH server and is now being passed on to the local endpoint, we decide whether or not to respond to the server-side EOF with a client-side EOF based on application preference. But I was doing the followup admin _outside_ that if statement, so if the server sent EOF and we _didn't_ want to send EOF in response, we still set the flag that said we'd sent it, and stopped reading from standard input. Result: if you use 'plink -nc' to talk to a remote network socket, and the server sends EOF first, Plink will never send EOF in the other direction, because it'll stop reading from standard input and never actually see the EOF that needs to be sent. --- ssh2connection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssh2connection.c b/ssh2connection.c index e4a2ede0..5a93a977 100644 --- a/ssh2connection.c +++ b/ssh2connection.c @@ -2267,9 +2267,9 @@ static void mainchan_send_eof(Channel *chan) */ sshfwd_write_eof(mc->sc); ppl_logevent(("Sent EOF message")); + s->mainchan_eof_sent = TRUE; + s->want_user_input = FALSE; /* now stop reading from stdin */ } - s->mainchan_eof_sent = TRUE; - s->want_user_input = FALSE; /* now stop reading from stdin */ } static void mainchan_set_input_wanted(Channel *chan, int wanted)