From: Howard Chu Date: Mon, 11 Dec 2023 17:56:51 +0000 (+0000) Subject: ITS#10143 only slapd should use the logfile X-Git-Tag: OPENLDAP_REL_ENG_2_6_7~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=efae4b1288b37f6e267afaeb4894e0c3832e338e;p=thirdparty%2Fopenldap.git ITS#10143 only slapd should use the logfile --- diff --git a/doc/man/man5/slapd-config.5 b/doc/man/man5/slapd-config.5 index dd105db32f..c1fa9c4eb1 100644 --- a/doc/man/man5/slapd-config.5 +++ b/doc/man/man5/slapd-config.5 @@ -564,12 +564,13 @@ see option description. The default is 71. .TP .B olcLogFile: -Specify a file for recording slapd debug messages. By default these messages -only go to stderr, are not recorded anywhere else, and are unrelated to -messages exposed by the +Specify a file for recording slapd debug messages. These messages are +unrelated to messages exposed by the .B olcLogLevel -configuration parameter. Specifying a logfile copies messages to both stderr -and the logfile. +configuration parameter. This setting only affects the slapd daemon and has +no effect on the command line tools. By default these messages +only go to stderr and are not recorded anywhere else. +Specifying a logfile copies messages to both stderr and the logfile. .TP .B olcLogFileFormat: debug | syslog-utc | syslog-localtime Specify the prefix format for messages written to the logfile. The debug diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index c7344b234e..36622d5b67 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -618,12 +618,13 @@ see option description. The default is 71. .TP .B logfile -Specify a file for recording slapd debug messages. By default these messages -only go to stderr, are not recorded anywhere else, and are unrelated to -messages exposed by the +Specify a file for recording slapd debug messages. These messages are +unrelated to messages exposed by the .B loglevel -configuration parameter. Specifying a logfile copies messages to both stderr -and the logfile. +configuration parameter. This setting only affects the slapd daemon and has +no effect on the command line tools. By default these messages +only go to stderr and are not recorded anywhere else. +Specifying a logfile copies messages to both stderr and the logfile. .TP .B logfile-format debug | syslog-utc | syslog-localtime Specify the prefix format for messages written to the logfile. The debug diff --git a/servers/slapd/logging.c b/servers/slapd/logging.c index 7dc33bde3f..95f7ff2500 100644 --- a/servers/slapd/logging.c +++ b/servers/slapd/logging.c @@ -201,6 +201,10 @@ logfile_open( const char *path ) struct stat st; int fd, saved_errno; + /* the logfile is for slapd only, not tools */ + if ( !( slapMode & SLAP_SERVER_MODE )) + return 0; + fd = open( path, O_CREAT|O_WRONLY, 0640 ); if ( fd < 0 ) { saved_errno = errno;