summaryrefslogtreecommitdiff
path: root/debian/patches/syslog-level-silent.patch
blob: 1c3dacb835e465d33b7830f100187fa78915f99b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
Description: Add "LogLevel SILENT" (-qq), suppressing even fatal errors
 It's not clear that this is as useful as originally intended, or
 implemented correctly, and there's no bug trail to be found for the
 original feature (although it has been tweaked by bug reports since it was
 added in Debian openssh 1:3.0.1p1-1).  Needs review.
Author: Jonathan David Amery <jdamery@ysolde.ucam.org>
Author: Matthew Vernon <matthew@debian.org>
Author: Colin Watson <cjwatson@debian.org>
Last-Update: 2010-02-27

Index: b/clientloop.c
===================================================================
--- a/clientloop.c
+++ b/clientloop.c
@@ -1533,7 +1533,7 @@
 	 * In interactive mode (with pseudo tty) display a message indicating
 	 * that the connection has been closed.
 	 */
-	if (have_pty && options.log_level != SYSLOG_LEVEL_QUIET) {
+	if (have_pty && options.log_level > SYSLOG_LEVEL_QUIET) {
 		snprintf(buf, sizeof buf,
 		    "Connection to %.64s closed.\r\n", host);
 		buffer_append(&stderr_buffer, buf, strlen(buf));
Index: b/log.c
===================================================================
--- a/log.c
+++ b/log.c
@@ -90,6 +90,7 @@
 	LogLevel val;
 } log_levels[] =
 {
+	{ "SILENT",	SYSLOG_LEVEL_SILENT },
 	{ "QUIET",	SYSLOG_LEVEL_QUIET },
 	{ "FATAL",	SYSLOG_LEVEL_FATAL },
 	{ "ERROR",	SYSLOG_LEVEL_ERROR },
@@ -244,6 +245,7 @@
 	argv0 = av0;
 
 	switch (level) {
+	case SYSLOG_LEVEL_SILENT:
 	case SYSLOG_LEVEL_QUIET:
 	case SYSLOG_LEVEL_FATAL:
 	case SYSLOG_LEVEL_ERROR:
Index: b/log.h
===================================================================
--- a/log.h
+++ b/log.h
@@ -35,6 +35,7 @@
 }       SyslogFacility;
 
 typedef enum {
+	SYSLOG_LEVEL_SILENT,
 	SYSLOG_LEVEL_QUIET,
 	SYSLOG_LEVEL_FATAL,
 	SYSLOG_LEVEL_ERROR,
Index: b/mux.c
===================================================================
--- a/mux.c
+++ b/mux.c
@@ -721,7 +721,7 @@
 	} else
 		debug2("Received exit status from master %d", exitval[0]);
 
-	if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET)
+	if (tty_flag && options.log_level > SYSLOG_LEVEL_QUIET)
 		fprintf(stderr, "Shared connection to %s closed.\r\n", host);
 
 	exit(exitval[0]);
Index: b/sftp-server.8
===================================================================
--- a/sftp-server.8
+++ b/sftp-server.8
@@ -64,7 +64,7 @@
 Specifies which messages will be logged by
 .Nm .
 The possible values are:
-QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
+SILENT, QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
 INFO and VERBOSE log transactions that
 .Nm
 performs on behalf of the client.
Index: b/ssh.1
===================================================================
--- a/ssh.1
+++ b/ssh.1
@@ -500,6 +500,11 @@
 .It Fl q
 Quiet mode.
 Causes most warning and diagnostic messages to be suppressed.
+Only fatal errors are displayed.
+If a second
+.Fl q
+is given then even fatal errors are suppressed, except for those produced
+due solely to bad arguments.
 .It Fl R Xo
 .Sm off
 .Oo Ar bind_address : Oc
Index: b/ssh.c
===================================================================
--- a/ssh.c
+++ b/ssh.c
@@ -389,7 +389,12 @@
 			}
 			break;
 		case 'q':
-			options.log_level = SYSLOG_LEVEL_QUIET;
+    		        if (options.log_level == SYSLOG_LEVEL_QUIET) {
+		                options.log_level = SYSLOG_LEVEL_SILENT;
+		        }
+		        else if (options.log_level != SYSLOG_LEVEL_SILENT) {
+		                options.log_level = SYSLOG_LEVEL_QUIET;
+		        }
 			break;
 		case 'e':
 			if (optarg[0] == '^' && optarg[2] == 0 &&
@@ -592,7 +597,7 @@
 		tty_flag = 0;
 	/* Do not allocate a tty if stdin is not a tty. */
 	if ((!isatty(fileno(stdin)) || stdin_null_flag) && !force_tty_flag) {
-		if (tty_flag)
+		if (tty_flag && options.log_level > SYSLOG_LEVEL_QUIET)
 			logit("Pseudo-terminal will not be allocated because "
 			    "stdin is not a terminal.");
 		tty_flag = 0;
Index: b/ssh_config.5
===================================================================
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -685,7 +685,7 @@
 Gives the verbosity level that is used when logging messages from
 .Xr ssh 1 .
 The possible values are:
-QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
+SILENT, QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
 The default is INFO.
 DEBUG and DEBUG1 are equivalent.
 DEBUG2 and DEBUG3 each specify higher levels of verbose output.
Index: b/sshd.8
===================================================================
--- a/sshd.8
+++ b/sshd.8
@@ -207,9 +207,12 @@
 option override command-line ports.
 .It Fl q
 Quiet mode.
-Nothing is sent to the system log.
+Only fatal errors are sent to the system log.
 Normally the beginning,
 authentication, and termination of each connection is logged.
+If a second 
+.Fl q
+is given then nothing is sent to the system log.
 .It Fl T
 Extended test mode.
 Check the validity of the configuration file, output the effective configuration
Index: b/sshd.c
===================================================================
--- a/sshd.c
+++ b/sshd.c
@@ -1355,7 +1355,12 @@
 			/* ignored */
 			break;
 		case 'q':
-			options.log_level = SYSLOG_LEVEL_QUIET;
+		        if (options.log_level == SYSLOG_LEVEL_QUIET) { 
+		                options.log_level = SYSLOG_LEVEL_SILENT; 
+		        } 
+		        else if (options.log_level != SYSLOG_LEVEL_SILENT) { 
+		                options.log_level = SYSLOG_LEVEL_QUIET; 
+		        } 
 			break;
 		case 'b':
 			options.server_key_bits = (int)strtonum(optarg, 256,
Index: b/sshd_config.5
===================================================================
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -567,7 +567,7 @@
 Gives the verbosity level that is used when logging messages from
 .Xr sshd 8 .
 The possible values are:
-QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
+SILENT, QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.
 The default is INFO.
 DEBUG and DEBUG1 are equivalent.
 DEBUG2 and DEBUG3 each specify higher levels of debugging output.