summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--clientloop.c30
-rw-r--r--log.c17
-rw-r--r--log.h4
-rw-r--r--ssh.112
5 files changed, 62 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 178d05006..439893da6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,10 @@
22 Send client banner immediately, rather than waiting for the server to 22 Send client banner immediately, rather than waiting for the server to
23 move first for SSH protocol 2 connections (the default). Patch based on 23 move first for SSH protocol 2 connections (the default). Patch based on
24 one in bz#1999 by tls AT panix.com, feedback dtucker@ ok markus@ 24 one in bz#1999 by tls AT panix.com, feedback dtucker@ ok markus@
25 - dtucker@cvs.openbsd.org 2012/09/06 04:37:39
26 [clientloop.c log.c ssh.1 log.h]
27 Add ~v and ~V escape sequences to raise and lower the logging level
28 respectively. Man page help from jmc, ok deraadt jmc
25 29
2620120830 3020120830
27 - (dtucker) [moduli] Import new moduli file. 31 - (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 @@
1/* $OpenBSD: clientloop.c,v 1.241 2012/08/17 00:45:45 dtucker Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.242 2012/09/06 04:37:38 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1099,6 +1099,31 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
1099 } 1099 }
1100 continue; 1100 continue;
1101 1101
1102 case 'V':
1103 /* FALLTHROUGH */
1104 case 'v':
1105 if (c && c->ctl_chan != -1)
1106 goto noescape;
1107 if (!log_is_on_stderr()) {
1108 snprintf(string, sizeof string,
1109 "%c%c [Logging to syslog]\r\n",
1110 escape_char, ch);
1111 buffer_append(berr, string,
1112 strlen(string));
1113 continue;
1114 }
1115 if (ch == 'V' && options.log_level >
1116 SYSLOG_LEVEL_QUIET)
1117 log_change_level(--options.log_level);
1118 if (ch == 'v' && options.log_level <
1119 SYSLOG_LEVEL_DEBUG3)
1120 log_change_level(++options.log_level);
1121 snprintf(string, sizeof string,
1122 "%c%c [LogLevel %s]\r\n", escape_char, ch,
1123 log_level_name(options.log_level));
1124 buffer_append(berr, string, strlen(string));
1125 continue;
1126
1102 case '&': 1127 case '&':
1103 if (c && c->ctl_chan != -1) 1128 if (c && c->ctl_chan != -1)
1104 goto noescape; 1129 goto noescape;
@@ -1175,6 +1200,8 @@ Supported escape sequences:\r\n\
1175 %cB - send a BREAK to the remote system\r\n\ 1200 %cB - send a BREAK to the remote system\r\n\
1176 %cC - open a command line\r\n\ 1201 %cC - open a command line\r\n\
1177 %cR - Request rekey (SSH protocol 2 only)\r\n\ 1202 %cR - Request rekey (SSH protocol 2 only)\r\n\
1203 %cV - Increase verbosity (LogLevel)\r\n\
1204 %cv - Decrease verbosity (LogLevel)\r\n\
1178 %c^Z - suspend ssh\r\n\ 1205 %c^Z - suspend ssh\r\n\
1179 %c# - list forwarded connections\r\n\ 1206 %c# - list forwarded connections\r\n\
1180 %c& - background ssh (when waiting for connections to terminate)\r\n\ 1207 %c& - background ssh (when waiting for connections to terminate)\r\n\
@@ -1186,6 +1213,7 @@ Supported escape sequences:\r\n\
1186 escape_char, escape_char, 1213 escape_char, escape_char,
1187 escape_char, escape_char, 1214 escape_char, escape_char,
1188 escape_char, escape_char, 1215 escape_char, escape_char,
1216 escape_char, escape_char,
1189 escape_char); 1217 escape_char);
1190 } 1218 }
1191 buffer_append(berr, string, strlen(string)); 1219 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 @@
1/* $OpenBSD: log.c,v 1.42 2011/06/17 21:44:30 djm Exp $ */ 1/* $OpenBSD: log.c,v 1.43 2012/09/06 04:37:39 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -329,6 +329,21 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
329#endif 329#endif
330} 330}
331 331
332void
333log_change_level(LogLevel new_log_level)
334{
335 /* no-op if log_init has not been called */
336 if (argv0 == NULL)
337 return;
338 log_init(argv0, new_log_level, log_facility, log_on_stderr);
339}
340
341int
342log_is_on_stderr(void)
343{
344 return log_on_stderr;
345}
346
332#define MSGBUFSIZ 1024 347#define MSGBUFSIZ 1024
333 348
334void 349void
diff --git a/log.h b/log.h
index 1b8d2142b..e3e328b06 100644
--- a/log.h
+++ b/log.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: log.h,v 1.18 2011/06/17 21:44:30 djm Exp $ */ 1/* $OpenBSD: log.h,v 1.19 2012/09/06 04:37:39 dtucker Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -49,6 +49,8 @@ typedef enum {
49typedef void (log_handler_fn)(LogLevel, const char *, void *); 49typedef void (log_handler_fn)(LogLevel, const char *, void *);
50 50
51void log_init(char *, LogLevel, SyslogFacility, int); 51void log_init(char *, LogLevel, SyslogFacility, int);
52void log_change_level(LogLevel);
53int log_is_on_stderr(void);
52 54
53SyslogFacility log_facility_number(char *); 55SyslogFacility log_facility_number(char *);
54const char * log_facility_name(SyslogFacility); 56const 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 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: ssh.1,v 1.326 2012/06/18 12:17:18 dtucker Exp $ 36.\" $OpenBSD: ssh.1,v 1.327 2012/09/06 04:37:39 dtucker Exp $
37.Dd $Mdocdate: June 18 2012 $ 37.Dd $Mdocdate: September 6 2012 $
38.Dt SSH 1 38.Dt SSH 1
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -926,6 +926,14 @@ option.
926.It Cm ~R 926.It Cm ~R
927Request rekeying of the connection 927Request rekeying of the connection
928(only useful for SSH protocol version 2 and if the peer supports it). 928(only useful for SSH protocol version 2 and if the peer supports it).
929.It Cm ~V
930Decrease the verbosity
931.Pq Ic LogLevel
932when errors are being written to stderr.
933.It Cm ~v
934Increase the verbosit
935.Pq Ic LogLevel
936when errors are being written to stderr.
929.El 937.El
930.Sh TCP FORWARDING 938.Sh TCP FORWARDING
931Forwarding of arbitrary TCP connections over the secure channel can 939Forwarding of arbitrary TCP connections over the secure channel can