From 37fbef7384b7b814152d8b5a2d81c7321b11d454 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 17 Aug 2012 00:45:46 +0000 Subject: Force a clean shutdown of ControlMaster client sessions when the ~. escape sequence is used. This means that ~. should now work in mux clients even if the server is no longer responding. Found by tedu, ok djm. --- usr.bin/ssh/clientloop.c | 4 +++- usr.bin/ssh/clientloop.h | 3 ++- usr.bin/ssh/mux.c | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'usr.bin/ssh') diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c index 81008a4a11d..5dc58e607fb 100644 --- a/usr.bin/ssh/clientloop.c +++ b/usr.bin/ssh/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.240 2012/06/20 04:42:58 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.241 2012/08/17 00:45:45 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1037,6 +1037,8 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, if (c && c->ctl_chan != -1) { chan_read_failed(c); chan_write_failed(c); + mux_master_session_cleanup_cb(c->self, + NULL); return 0; } else quit_pending = 1; diff --git a/usr.bin/ssh/clientloop.h b/usr.bin/ssh/clientloop.h index 3bb794879c5..d2baa032457 100644 --- a/usr.bin/ssh/clientloop.h +++ b/usr.bin/ssh/clientloop.h @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.h,v 1.29 2011/09/09 22:46:44 djm Exp $ */ +/* $OpenBSD: clientloop.h,v 1.30 2012/08/17 00:45:45 dtucker Exp $ */ /* * Author: Tatu Ylonen @@ -76,4 +76,5 @@ void muxserver_listen(void); void muxclient(const char *); void mux_exit_message(Channel *, int); void mux_tty_alloc_failed(Channel *); +void mux_master_session_cleanup_cb(int, void *); diff --git a/usr.bin/ssh/mux.c b/usr.bin/ssh/mux.c index 66cc5fdf84e..57b28a1fd75 100644 --- a/usr.bin/ssh/mux.c +++ b/usr.bin/ssh/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.36 2012/07/06 01:37:21 djm Exp $ */ +/* $OpenBSD: mux.c,v 1.37 2012/08/17 00:45:45 dtucker Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller * @@ -171,7 +171,7 @@ static const struct { /* Cleanup callback fired on closure of mux slave _session_ channel */ /* ARGSUSED */ -static void +void mux_master_session_cleanup_cb(int cid, void *unused) { Channel *cc, *c = channel_by_id(cid); -- cgit v1.2.3