Skip to content

Commit a2e78a1

Browse files
committed
tlshd: Split the debug command-line option
Set the debugging level with one option and control where debug messages go with a different one. This should prevent two copies of each audit message appearing in the kernel log when debugging is enabled. Signed-off-by: Chuck Lever <[email protected]>
1 parent ecaf660 commit a2e78a1

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

src/tlshd/log.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
int tlshd_debug;
4040
int tlshd_library_debug;
41+
int tlshd_stderr;
4142

4243
/**
4344
* tlshd_log_success - Emit "handshake successful" notification
@@ -207,7 +208,7 @@ void tlshd_log_init(const char *progname)
207208
int option;
208209

209210
option = LOG_NDELAY;
210-
if (tlshd_debug)
211+
if (tlshd_stderr)
211212
option |= LOG_PERROR;
212213
openlog(progname, option, LOG_AUTH);
213214

src/tlshd/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ static const struct option longopts[] = {
5353
{ "help", no_argument, NULL, 'h' },
5454
{ "libdebug", required_argument, NULL, 'l' },
5555
{ "noverify", no_argument, NULL, 'n' },
56+
{ "stderr", no_argument, NULL, 's' },
5657
{ "version", no_argument, NULL, 'v' },
5758
{ NULL, 0, NULL, 0 }
5859
};
@@ -171,6 +172,9 @@ int main(int argc, char **argv)
171172
case 'n':
172173
tlshd_verify_server = 0;
173174
break;
175+
case 's':
176+
tlshd_stderr = 1;
177+
break;
174178
case 'v':
175179
fprintf(stderr, "%s, built from " PACKAGE_STRING
176180
" on " __DATE__ " " __TIME__ "\n",

src/tlshd/tlshd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
extern int tlshd_debug;
2222
extern int tlshd_library_debug;
2323
extern int tlshd_verify_server;
24+
extern int tlshd_stderr;
2425

2526
/* handshake.c */
2627
extern void tlshd_client_handshake(gnutls_session_t session);

src/tlshd/tlshd.man

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ the use of kTLS to secure subsequent communication on that socket.
3939
.SH OPTIONS
4040
.TP
4141
.B \-d " or " \-\-debug
42-
When specified this option forces audit messages to both
43-
.I stderr
44-
and the system log.
45-
By default, audit messages go only the system log.
42+
When specified this option enables verbose debugging.
43+
By default, operation is quiet.
4644
.TP
4745
.B \-h " or " \-\-help
4846
When specified tlshd displays a help message then exits immediately.
@@ -61,6 +59,12 @@ verifies server credentials during anonymous handshakes.
6159
.IP
6260
Do not use this option on secure systems.
6361
.TP
62+
.B \-s " or " \-\-stderr
63+
When specified this option forces messages to go to both
64+
.I stderr
65+
and the system log.
66+
By default, messages go only to the system log.
67+
.TP
6468
.B \-v " or " \-\-version
6569
When specified tlshd displays build version information then exits immediately.
6670
.SH ENVIRONMENT VARIABLES

0 commit comments

Comments
 (0)