diff options
author | djm@openbsd.org <djm@openbsd.org> | 2017-05-17 03:24:17 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-05-17 03:25:22 +0200 |
commit | 54cd41a4663fad66406dd3c8fe0e4760ccd8a899 (patch) | |
tree | 382e0546d26cf1bb6ce54c0dc1b5278df697450c /log.c | |
parent | upstream commit (diff) | |
download | openssh-54cd41a4663fad66406dd3c8fe0e4760ccd8a899.tar.xz openssh-54cd41a4663fad66406dd3c8fe0e4760ccd8a899.zip |
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.c | 35 |
1 files changed, 19 insertions, 16 deletions
@@ -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 |