summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-05-17 01:24:17 +0000
committerDamien Miller <djm@mindrot.org>2017-05-17 11:25:22 +1000
commit54cd41a4663fad66406dd3c8fe0e4760ccd8a899 (patch)
tree382e0546d26cf1bb6ce54c0dc1b5278df697450c /log.c
parent277abcda3f1b08d2376686f0ef20320160d4c8ab (diff)
upstream commit
allow LogLevel in sshd_config Match blocks; ok dtucker bz#2717 Upstream-ID: 662e303be63148f47db1aa78ab81c5c2e732baa8
Diffstat (limited to 'log.c')
-rw-r--r--log.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/log.c b/log.c
index d0f86cf6..99450dd1 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.49 2017/03/10 03:15:58 djm Exp $ */
+/* $OpenBSD: log.c,v 1.50 2017/05/17 01:24:17 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -256,18 +256,7 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
argv0 = av0;
- switch (level) {
- case SYSLOG_LEVEL_QUIET:
- case SYSLOG_LEVEL_FATAL:
- case SYSLOG_LEVEL_ERROR:
- case SYSLOG_LEVEL_INFO:
- case SYSLOG_LEVEL_VERBOSE:
- case SYSLOG_LEVEL_DEBUG1:
- case SYSLOG_LEVEL_DEBUG2:
- case SYSLOG_LEVEL_DEBUG3:
- log_level = level;
- break;
- default:
+ if (log_change_level(level) != 0) {
fprintf(stderr, "Unrecognized internal syslog level code %d\n",
(int) level);
exit(1);
@@ -340,13 +329,27 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
#endif
}
-void
+int
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);
+ return 0;
+
+ switch (new_log_level) {
+ case SYSLOG_LEVEL_QUIET:
+ case SYSLOG_LEVEL_FATAL:
+ case SYSLOG_LEVEL_ERROR:
+ case SYSLOG_LEVEL_INFO:
+ case SYSLOG_LEVEL_VERBOSE:
+ case SYSLOG_LEVEL_DEBUG1:
+ case SYSLOG_LEVEL_DEBUG2:
+ case SYSLOG_LEVEL_DEBUG3:
+ log_level = new_log_level;
+ return 0;
+ default:
+ return -1;
+ }
}
int