diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | log.c | 16 |
2 files changed, 23 insertions, 1 deletions
@@ -1,3 +1,9 @@ | |||
1 | 20050201 | ||
2 | - (dtucker) [log.c] Bug #973: force log_init() to open syslog, since on some | ||
3 | platforms syslog will revert to its default values. This may result in | ||
4 | messages from external libraries (eg libwrap) being sent to a different | ||
5 | facility. | ||
6 | |||
1 | 20050124 | 7 | 20050124 |
2 | - (dtucker) OpenBSD CVS Sync | 8 | - (dtucker) OpenBSD CVS Sync |
3 | - otto@cvs.openbsd.org 2005/01/21 08:32:02 | 9 | - otto@cvs.openbsd.org 2005/01/21 08:32:02 |
@@ -2043,4 +2049,4 @@ | |||
2043 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 2049 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
2044 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 2050 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
2045 | 2051 | ||
2046 | $Id: ChangeLog,v 1.3626 2005/01/24 11:50:47 dtucker Exp $ | 2052 | $Id: ChangeLog,v 1.3627 2005/02/01 06:35:09 dtucker Exp $ |
@@ -194,6 +194,9 @@ void | |||
194 | log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | 194 | log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) |
195 | { | 195 | { |
196 | argv0 = av0; | 196 | argv0 = av0; |
197 | #if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) | ||
198 | struct syslog_data sdata = SYSLOG_DATA_INIT; | ||
199 | #endif | ||
197 | 200 | ||
198 | switch (level) { | 201 | switch (level) { |
199 | case SYSLOG_LEVEL_QUIET: | 202 | case SYSLOG_LEVEL_QUIET: |
@@ -261,6 +264,19 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | |||
261 | (int) facility); | 264 | (int) facility); |
262 | exit(1); | 265 | exit(1); |
263 | } | 266 | } |
267 | |||
268 | /* | ||
269 | * If an external library (eg libwrap) attempts to use syslog | ||
270 | * immediately after reexec, syslog may be pointing to the wrong | ||
271 | * facility, so we force an open/close of syslog here. | ||
272 | */ | ||
273 | #if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) | ||
274 | openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata); | ||
275 | closelog_r(&sdata); | ||
276 | #else | ||
277 | openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility); | ||
278 | closelog(); | ||
279 | #endif | ||
264 | } | 280 | } |
265 | 281 | ||
266 | #define MSGBUFSIZ 1024 | 282 | #define MSGBUFSIZ 1024 |