From 66cb0e0733782c2f6773abd9fd1d87f5efef6c27 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 6 Sep 2012 21:19:05 +1000 Subject: - dtucker@cvs.openbsd.org 2012/08/17 00:45:45 [clientloop.c clientloop.h mux.c] 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. --- clientloop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clientloop.c') diff --git a/clientloop.c b/clientloop.c index 1c1a77088..65664cbcd 100644 --- a/clientloop.c +++ b/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 @@ -1046,6 +1046,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; -- cgit v1.2.3 From 50a48d025ffc961c3f5e48f521b406d7c49681bb Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 6 Sep 2012 21:25:37 +1000 Subject: - dtucker@cvs.openbsd.org 2012/09/06 04:37:39 [clientloop.c log.c ssh.1 log.h] Add ~v and ~V escape sequences to raise and lower the logging level respectively. Man page help from jmc, ok deraadt jmc --- ChangeLog | 4 ++++ clientloop.c | 30 +++++++++++++++++++++++++++++- log.c | 17 ++++++++++++++++- log.h | 4 +++- ssh.1 | 12 ++++++++++-- 5 files changed, 62 insertions(+), 5 deletions(-) (limited to 'clientloop.c') diff --git a/ChangeLog b/ChangeLog index 178d05006..439893da6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,10 @@ Send client banner immediately, rather than waiting for the server to move first for SSH protocol 2 connections (the default). Patch based on one in bz#1999 by tls AT panix.com, feedback dtucker@ ok markus@ + - dtucker@cvs.openbsd.org 2012/09/06 04:37:39 + [clientloop.c log.c ssh.1 log.h] + Add ~v and ~V escape sequences to raise and lower the logging level + respectively. Man page help from jmc, ok deraadt jmc 20120830 - (dtucker) [moduli] Import new moduli file. diff --git a/clientloop.c b/clientloop.c index 65664cbcd..0e5c45a9d 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.241 2012/08/17 00:45:45 dtucker Exp $ */ +/* $OpenBSD: clientloop.c,v 1.242 2012/09/06 04:37:38 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1099,6 +1099,31 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, } continue; + case 'V': + /* FALLTHROUGH */ + case 'v': + if (c && c->ctl_chan != -1) + goto noescape; + if (!log_is_on_stderr()) { + snprintf(string, sizeof string, + "%c%c [Logging to syslog]\r\n", + escape_char, ch); + buffer_append(berr, string, + strlen(string)); + continue; + } + if (ch == 'V' && options.log_level > + SYSLOG_LEVEL_QUIET) + log_change_level(--options.log_level); + if (ch == 'v' && options.log_level < + SYSLOG_LEVEL_DEBUG3) + log_change_level(++options.log_level); + snprintf(string, sizeof string, + "%c%c [LogLevel %s]\r\n", escape_char, ch, + log_level_name(options.log_level)); + buffer_append(berr, string, strlen(string)); + continue; + case '&': if (c && c->ctl_chan != -1) goto noescape; @@ -1175,6 +1200,8 @@ Supported escape sequences:\r\n\ %cB - send a BREAK to the remote system\r\n\ %cC - open a command line\r\n\ %cR - Request rekey (SSH protocol 2 only)\r\n\ + %cV - Increase verbosity (LogLevel)\r\n\ + %cv - Decrease verbosity (LogLevel)\r\n\ %c^Z - suspend ssh\r\n\ %c# - list forwarded connections\r\n\ %c& - background ssh (when waiting for connections to terminate)\r\n\ @@ -1186,6 +1213,7 @@ Supported escape sequences:\r\n\ escape_char, escape_char, escape_char, escape_char, escape_char, escape_char, + escape_char, escape_char, escape_char); } buffer_append(berr, string, strlen(string)); diff --git a/log.c b/log.c index ad5a10b47..7f4a1b9c6 100644 --- a/log.c +++ b/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.42 2011/06/17 21:44:30 djm Exp $ */ +/* $OpenBSD: log.c,v 1.43 2012/09/06 04:37:39 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -329,6 +329,21 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) #endif } +void +log_change_level(LogLevel new_log_level) +{ + /* no-op if log_init has not been called */ + if (argv0 == NULL) + return; + log_init(argv0, new_log_level, log_facility, log_on_stderr); +} + +int +log_is_on_stderr(void) +{ + return log_on_stderr; +} + #define MSGBUFSIZ 1024 void diff --git a/log.h b/log.h index 1b8d2142b..e3e328b06 100644 --- a/log.h +++ b/log.h @@ -1,4 +1,4 @@ -/* $OpenBSD: log.h,v 1.18 2011/06/17 21:44:30 djm Exp $ */ +/* $OpenBSD: log.h,v 1.19 2012/09/06 04:37:39 dtucker Exp $ */ /* * Author: Tatu Ylonen @@ -49,6 +49,8 @@ typedef enum { typedef void (log_handler_fn)(LogLevel, const char *, void *); void log_init(char *, LogLevel, SyslogFacility, int); +void log_change_level(LogLevel); +int log_is_on_stderr(void); SyslogFacility log_facility_number(char *); const char * log_facility_name(SyslogFacility); diff --git a/ssh.1 b/ssh.1 index eaf5d83db..65342ff8f 100644 --- a/ssh.1 +++ b/ssh.1 @@ -33,8 +33,8 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: ssh.1,v 1.326 2012/06/18 12:17:18 dtucker Exp $ -.Dd $Mdocdate: June 18 2012 $ +.\" $OpenBSD: ssh.1,v 1.327 2012/09/06 04:37:39 dtucker Exp $ +.Dd $Mdocdate: September 6 2012 $ .Dt SSH 1 .Os .Sh NAME @@ -926,6 +926,14 @@ option. .It Cm ~R Request rekeying of the connection (only useful for SSH protocol version 2 and if the peer supports it). +.It Cm ~V +Decrease the verbosity +.Pq Ic LogLevel +when errors are being written to stderr. +.It Cm ~v +Increase the verbosit +.Pq Ic LogLevel +when errors are being written to stderr. .El .Sh TCP FORWARDING Forwarding of arbitrary TCP connections over the secure channel can -- cgit v1.2.3 From 29bf4040b4aa98ce8b1be57a3107ddb1eaa085b4 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 6 Sep 2012 21:26:34 +1000 Subject: - dtucker@cvs.openbsd.org 2012/09/06 09:50:13 [clientloop.c] Make the escape command help (~?) context sensitive so that only commands that will work in the current session are shown. ok markus@ --- ChangeLog | 4 ++++ clientloop.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'clientloop.c') diff --git a/ChangeLog b/ChangeLog index 439893da6..03b16cc2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,10 @@ [clientloop.c log.c ssh.1 log.h] Add ~v and ~V escape sequences to raise and lower the logging level respectively. Man page help from jmc, ok deraadt jmc + - dtucker@cvs.openbsd.org 2012/09/06 09:50:13 + [clientloop.c] + Make the escape command help (~?) context sensitive so that only commands + that will work in the current session are shown. ok markus@ 20120830 - (dtucker) [moduli] Import new moduli file. diff --git a/clientloop.c b/clientloop.c index 0e5c45a9d..72b1d40f0 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.242 2012/09/06 04:37:38 dtucker Exp $ */ +/* $OpenBSD: clientloop.c,v 1.243 2012/09/06 06:25:41 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1200,8 +1200,8 @@ Supported escape sequences:\r\n\ %cB - send a BREAK to the remote system\r\n\ %cC - open a command line\r\n\ %cR - Request rekey (SSH protocol 2 only)\r\n\ - %cV - Increase verbosity (LogLevel)\r\n\ - %cv - Decrease verbosity (LogLevel)\r\n\ + %cV - Decrease verbosity (LogLevel)\r\n\ + %cv - Increase verbosity (LogLevel)\r\n\ %c^Z - suspend ssh\r\n\ %c# - list forwarded connections\r\n\ %c& - background ssh (when waiting for connections to terminate)\r\n\ -- cgit v1.2.3 From 92a39cfa09e38152be34437345577105c4110438 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 7 Sep 2012 11:20:20 +1000 Subject: - dtucker@cvs.openbsd.org 2012/09/06 09:50:13 [clientloop.c] Make the escape command help (~?) context sensitive so that only commands that will work in the current session are shown. ok markus@ (note: previous commit with this description was a mistake on my part while pulling changes from OpenBSD) --- ChangeLog | 11 ++++--- clientloop.c | 103 +++++++++++++++++++++++++++++++++++------------------------ 2 files changed, 69 insertions(+), 45 deletions(-) (limited to 'clientloop.c') diff --git a/ChangeLog b/ChangeLog index 242ef4043..dead49719 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +20120907 + - (dtucker) OpenBSD CVS Sync + - dtucker@cvs.openbsd.org 2012/09/06 09:50:13 + [clientloop.c] + Make the escape command help (~?) context sensitive so that only commands + that will work in the current session are shown. ok markus@ + 20120906 - (dtucker) OpenBSD CVS Sync - jmc@cvs.openbsd.org 2012/08/15 18:25:50 @@ -26,10 +33,6 @@ [clientloop.c log.c ssh.1 log.h] Add ~v and ~V escape sequences to raise and lower the logging level respectively. Man page help from jmc, ok deraadt jmc - - dtucker@cvs.openbsd.org 2012/09/06 09:50:13 - [clientloop.c] - Make the escape command help (~?) context sensitive so that only commands - that will work in the current session are shown. ok markus@ 20120830 - (dtucker) [moduli] Import new moduli file. diff --git a/clientloop.c b/clientloop.c index 72b1d40f0..07d2c8923 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.243 2012/09/06 06:25:41 dtucker Exp $ */ +/* $OpenBSD: clientloop.c,v 1.244 2012/09/06 09:50:13 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -996,6 +996,64 @@ out: xfree(fwd.connect_host); } +/* reasons to suppress output of an escape command in help output */ +#define SUPPRESS_NEVER 0 /* never suppress, always show */ +#define SUPPRESS_PROTO1 1 /* don't show in protocol 1 sessions */ +#define SUPPRESS_MUXCLIENT 2 /* don't show in mux client sessions */ +#define SUPPRESS_MUXMASTER 4 /* don't show in mux master sessions */ +#define SUPPRESS_SYSLOG 8 /* don't show when logging to syslog */ +struct escape_help_text { + const char *cmd; + const char *text; + unsigned int flags; +}; +static struct escape_help_text esc_txt[] = { + {".", "terminate session", SUPPRESS_MUXMASTER}, + {".", "terminate connection (and any multiplexed sessions)", + SUPPRESS_MUXCLIENT}, + {"B", "send a BREAK to the remote system", SUPPRESS_PROTO1}, + {"C", "open a command line", SUPPRESS_MUXCLIENT}, + {"R", "request rekey", SUPPRESS_PROTO1}, + {"V", "decrease verbosity (LogLevel)", SUPPRESS_MUXCLIENT}, + {"v", "increase verbosity (LogLevel)", SUPPRESS_MUXCLIENT}, + {"^Z", "suspend ssh", SUPPRESS_MUXCLIENT}, + {"#", "list forwarded connections", SUPPRESS_NEVER}, + {"&", "background ssh (when waiting for connections to terminate)", + SUPPRESS_MUXCLIENT}, + {"?", "this message", SUPPRESS_NEVER}, +}; + +static void +print_escape_help(Buffer *b, int escape_char, int protocol2, int mux_client, + int using_stderr) +{ + unsigned int i, suppress_flags; + char string[1024]; + + snprintf(string, sizeof string, "%c?\r\n" + "Supported escape sequences:\r\n", escape_char); + buffer_append(b, string, strlen(string)); + + suppress_flags = (protocol2 ? 0 : SUPPRESS_PROTO1) | + (mux_client ? SUPPRESS_MUXCLIENT : 0) | + (mux_client ? 0 : SUPPRESS_MUXMASTER) | + (using_stderr ? 0 : SUPPRESS_SYSLOG); + + for (i = 0; i < sizeof(esc_txt)/sizeof(esc_txt[0]); i++) { + if (esc_txt[i].flags & suppress_flags) + continue; + snprintf(string, sizeof string, " %c%-2s - %s\r\n", + escape_char, esc_txt[i].cmd, esc_txt[i].text); + buffer_append(b, string, strlen(string)); + } + + snprintf(string, sizeof string, + " %c%c - send the escape character by typing it twice\r\n" + "(Note that escapes are only recognized immediately after " + "newline.)\r\n", escape_char, escape_char); + buffer_append(b, string, strlen(string)); +} + /* * Process the characters one by one, call with c==NULL for proto1 case. */ @@ -1177,46 +1235,9 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, continue; case '?': - if (c && c->ctl_chan != -1) { - snprintf(string, sizeof string, -"%c?\r\n\ -Supported escape sequences:\r\n\ - %c. - terminate session\r\n\ - %cB - send a BREAK to the remote system\r\n\ - %cR - Request rekey (SSH protocol 2 only)\r\n\ - %c# - list forwarded connections\r\n\ - %c? - this message\r\n\ - %c%c - send the escape character by typing it twice\r\n\ -(Note that escapes are only recognized immediately after newline.)\r\n", - escape_char, escape_char, - escape_char, escape_char, - escape_char, escape_char, - escape_char, escape_char); - } else { - snprintf(string, sizeof string, -"%c?\r\n\ -Supported escape sequences:\r\n\ - %c. - terminate connection (and any multiplexed sessions)\r\n\ - %cB - send a BREAK to the remote system\r\n\ - %cC - open a command line\r\n\ - %cR - Request rekey (SSH protocol 2 only)\r\n\ - %cV - Decrease verbosity (LogLevel)\r\n\ - %cv - Increase verbosity (LogLevel)\r\n\ - %c^Z - suspend ssh\r\n\ - %c# - list forwarded connections\r\n\ - %c& - background ssh (when waiting for connections to terminate)\r\n\ - %c? - this message\r\n\ - %c%c - send the escape character by typing it twice\r\n\ -(Note that escapes are only recognized immediately after newline.)\r\n", - escape_char, escape_char, - escape_char, escape_char, - escape_char, escape_char, - escape_char, escape_char, - escape_char, escape_char, - escape_char, escape_char, - escape_char); - } - buffer_append(berr, string, strlen(string)); + print_escape_help(berr, escape_char, compat20, + (c && c->ctl_chan != -1), + log_is_on_stderr()); continue; case '#': -- cgit v1.2.3 From f111d40604846da18b190155b85fa72d58647802 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 7 Sep 2012 11:21:42 +1000 Subject: - dtucker@cvs.openbsd.org 2012/09/07 00:30:19 [clientloop.c] Print '^Z' instead of a raw ^Z when the sequence is not supported. ok djm@ --- ChangeLog | 3 +++ clientloop.c | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'clientloop.c') diff --git a/ChangeLog b/ChangeLog index 9fb565c6e..b3ec3e2a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ - jmc@cvs.openbsd.org 2012/09/06 13:57:42 [ssh.1] missing letter in previous; + - dtucker@cvs.openbsd.org 2012/09/07 00:30:19 + [clientloop.c] + Print '^Z' instead of a raw ^Z when the sequence is not supported. ok djm@ 20120906 - (dtucker) OpenBSD CVS Sync diff --git a/clientloop.c b/clientloop.c index 07d2c8923..20fa4b9f4 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.244 2012/09/06 09:50:13 dtucker Exp $ */ +/* $OpenBSD: clientloop.c,v 1.245 2012/09/07 00:30:19 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1114,11 +1114,16 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr, case 'Z' - 64: /* XXX support this for mux clients */ if (c && c->ctl_chan != -1) { + char b[16]; noescape: + if (ch == 'Z' - 64) + snprintf(b, sizeof b, "^Z"); + else + snprintf(b, sizeof b, "%c", ch); snprintf(string, sizeof string, - "%c%c escape not available to " + "%c%s escape not available to " "multiplexed sessions\r\n", - escape_char, ch); + escape_char, b); buffer_append(berr, string, strlen(string)); continue; -- cgit v1.2.3 From ca0d0fd806ebce746ac0bee52995fc32b1116656 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 7 Sep 2012 11:22:24 +1000 Subject: - dtucker@cvs.openbsd.org 2012/09/07 01:10:21 [clientloop.c] Merge escape help text for ~v and ~V; ok djm@ --- ChangeLog | 3 +++ clientloop.c | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'clientloop.c') diff --git a/ChangeLog b/ChangeLog index b3ec3e2a0..289dc0011 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,9 @@ - dtucker@cvs.openbsd.org 2012/09/07 00:30:19 [clientloop.c] Print '^Z' instead of a raw ^Z when the sequence is not supported. ok djm@ + - dtucker@cvs.openbsd.org 2012/09/07 01:10:21 + [clientloop.c] + Merge escape help text for ~v and ~V; ok djm@ 20120906 - (dtucker) OpenBSD CVS Sync diff --git a/clientloop.c b/clientloop.c index 20fa4b9f4..3de542814 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.245 2012/09/07 00:30:19 dtucker Exp $ */ +/* $OpenBSD: clientloop.c,v 1.246 2012/09/07 01:10:21 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1014,8 +1014,7 @@ static struct escape_help_text esc_txt[] = { {"B", "send a BREAK to the remote system", SUPPRESS_PROTO1}, {"C", "open a command line", SUPPRESS_MUXCLIENT}, {"R", "request rekey", SUPPRESS_PROTO1}, - {"V", "decrease verbosity (LogLevel)", SUPPRESS_MUXCLIENT}, - {"v", "increase verbosity (LogLevel)", SUPPRESS_MUXCLIENT}, + {"V/v", "decrease/increase verbosity (LogLevel)", SUPPRESS_MUXCLIENT}, {"^Z", "suspend ssh", SUPPRESS_MUXCLIENT}, {"#", "list forwarded connections", SUPPRESS_NEVER}, {"&", "background ssh (when waiting for connections to terminate)", @@ -1042,13 +1041,13 @@ print_escape_help(Buffer *b, int escape_char, int protocol2, int mux_client, for (i = 0; i < sizeof(esc_txt)/sizeof(esc_txt[0]); i++) { if (esc_txt[i].flags & suppress_flags) continue; - snprintf(string, sizeof string, " %c%-2s - %s\r\n", + snprintf(string, sizeof string, " %c%-3s - %s\r\n", escape_char, esc_txt[i].cmd, esc_txt[i].text); buffer_append(b, string, strlen(string)); } snprintf(string, sizeof string, - " %c%c - send the escape character by typing it twice\r\n" + " %c%c - send the escape character by typing it twice\r\n" "(Note that escapes are only recognized immediately after " "newline.)\r\n", escape_char, escape_char); buffer_append(b, string, strlen(string)); -- cgit v1.2.3 From 48bf4b0ca366d68ef9c5ce95cb0c49fb3e149a40 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 7 Sep 2012 16:38:53 +1000 Subject: - dtucker@cvs.openbsd.org 2012/09/07 06:34:21 [clientloop.c] when muxmaster is run with -N, make it shut down gracefully when a client sends it "-O stop" rather than hanging around (bz#1985). ok djm@ --- ChangeLog | 4 ++++ clientloop.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'clientloop.c') diff --git a/ChangeLog b/ChangeLog index 289dc0011..1655f764c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ - dtucker@cvs.openbsd.org 2012/09/07 01:10:21 [clientloop.c] Merge escape help text for ~v and ~V; ok djm@ + - dtucker@cvs.openbsd.org 2012/09/07 06:34:21 + [clientloop.c] + when muxmaster is run with -N, make it shut down gracefully when a client + sends it "-O stop" rather than hanging around (bz#1985). ok djm@ 20120906 - (dtucker) OpenBSD CVS Sync diff --git a/clientloop.c b/clientloop.c index 3de542814..564508146 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.246 2012/09/07 01:10:21 dtucker Exp $ */ +/* $OpenBSD: clientloop.c,v 1.247 2012/09/07 06:34:21 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -2244,10 +2244,10 @@ client_stop_mux(void) if (options.control_path != NULL && muxserver_sock != -1) unlink(options.control_path); /* - * If we are in persist mode, signal that we should close when all - * active channels are closed. + * If we are in persist mode, or don't have a shell, signal that we + * should close when all active channels are closed. */ - if (options.control_persist) { + if (options.control_persist || no_shell_flag) { session_closed = 1; setproctitle("[stopped mux]"); } -- cgit v1.2.3 From 73298f420efd37659f462d3eb10d8a7f71022e1b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 9 Jan 2013 15:55:50 +1100 Subject: - djm@cvs.openbsd.org 2013/01/02 00:32:07 [clientloop.c mux.c] channel_setup_local_fwd_listener() returns 0 on failure, not -ve bz#2055 reported by mathieu.lacage AT gmail.com --- ChangeLog | 4 ++++ clientloop.c | 6 +++--- mux.c | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'clientloop.c') diff --git a/ChangeLog b/ChangeLog index 3a84d27ed..3b15b99c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ - dtucker@cvs.openbsd.org 2012/12/14 05:26:43 [auth.c] use correct string in error message; from rustybsd at gmx.fr + - djm@cvs.openbsd.org 2013/01/02 00:32:07 + [clientloop.c mux.c] + channel_setup_local_fwd_listener() returns 0 on failure, not -ve + bz#2055 reported by mathieu.lacage AT gmail.com 20121217 - (dtucker) [Makefile.in] Add some scaffolding so that the new regress diff --git a/clientloop.c b/clientloop.c index 564508146..c1d1d4472 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.247 2012/09/07 06:34:21 dtucker Exp $ */ +/* $OpenBSD: clientloop.c,v 1.248 2013/01/02 00:32:07 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -968,9 +968,9 @@ process_cmdline(void) goto out; } if (local || dynamic) { - if (channel_setup_local_fwd_listener(fwd.listen_host, + if (!channel_setup_local_fwd_listener(fwd.listen_host, fwd.listen_port, fwd.connect_host, - fwd.connect_port, options.gateway_ports) < 0) { + fwd.connect_port, options.gateway_ports)) { logit("Port forwarding failed."); goto out; } diff --git a/mux.c b/mux.c index 0f1532bb5..1b24660b2 100644 --- a/mux.c +++ b/mux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mux.c,v 1.37 2012/08/17 00:45:45 dtucker Exp $ */ +/* $OpenBSD: mux.c,v 1.38 2013/01/02 00:32:07 djm Exp $ */ /* * Copyright (c) 2002-2008 Damien Miller * @@ -738,9 +738,9 @@ process_mux_open_fwd(u_int rid, Channel *c, Buffer *m, Buffer *r) } if (ftype == MUX_FWD_LOCAL || ftype == MUX_FWD_DYNAMIC) { - if (channel_setup_local_fwd_listener(fwd.listen_host, + if (!channel_setup_local_fwd_listener(fwd.listen_host, fwd.listen_port, fwd.connect_host, fwd.connect_port, - options.gateway_ports) < 0) { + options.gateway_ports)) { fail: logit("slave-requested %s failed", fwd_desc); buffer_put_int(r, MUX_S_FAILURE); -- cgit v1.2.3