diff options
author | Darren Tucker <dtucker@zip.com.au> | 2005-02-01 17:35:09 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2005-02-01 17:35:09 +1100 |
commit | 9b5495d23ee28fa77dc58a31953d3f6f86d5baa1 (patch) | |
tree | 9d59888e0551238b940dd4978354330584d174d4 /log.c | |
parent | 218f178cb20c276027e972bff0208043fcf533a3 (diff) | |
download | openssh-git-9b5495d23ee28fa77dc58a31953d3f6f86d5baa1.tar.gz |
- (dtucker) [log.c] Bug #973: force log_init() to open syslog, since on some
platforms syslog will revert to its default values. This may result in
messages from external libraries (eg libwrap) being sent to a different
facility.
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -194,6 +194,9 @@ void log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) { argv0 = av0; +#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) + struct syslog_data sdata = SYSLOG_DATA_INIT; +#endif switch (level) { case SYSLOG_LEVEL_QUIET: @@ -261,6 +264,19 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) (int) facility); exit(1); } + + /* + * If an external library (eg libwrap) attempts to use syslog + * immediately after reexec, syslog may be pointing to the wrong + * facility, so we force an open/close of syslog here. + */ +#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) + openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata); + closelog_r(&sdata); +#else + openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility); + closelog(); +#endif } #define MSGBUFSIZ 1024 |