tests: Prevent syslog activity by slapd, take 2
authorAndres Freund <andres@anarazel.de>
Fri, 17 Mar 2023 06:03:31 +0000 (23:03 -0700)
committerAndres Freund <andres@anarazel.de>
Fri, 17 Mar 2023 06:07:29 +0000 (23:07 -0700)
Unfortunately it turns out that the logfile-only option added in b9f8d1cbad7
is only available in openldap starting in 2.6.

Luckily the option to control the log level (loglevel/-s) have been around for
much longer. As it turns out loglevel/-s only control what goes into syslog,
not what ends up in the file specified with 'logfile' and stderr.

While we currently are specifying 'logfile', nothing ends up in it, as the
option only controls debug messages, and we didn't set a debug level. The
debug level can only be configured on the commandline and also prevents
forking. That'd require larger changes, so this commit doesn't tackle that
issue.

Specify the syslog level when starting slapd using -s, as that allows to
prevent all syslog messages if one uses '0' instead of 'none', while loglevel
doesn't prevent the first message.

Discussion: https://postgr.es/m/20230311233708.3yjdbjkly2q4gq2j@awork3.anarazel.de
Backpatch: 11-

src/test/ldap/LdapServer.pm

index ae2a1894cf4d6ae39c141863a781b6009c35a5b8..8c69f660f5cfce8ca3b0f86d91b6d05281a89faf 100644 (file)
@@ -169,7 +169,6 @@ sub new
 
                pidfile $slapd_pidfile
                logfile $slapd_logfile
-               logfile-only on
 
                access to *
                        by * read
@@ -205,7 +204,8 @@ EOC
        append_to_file($ldap_pwfile, $ldap_rootpw);
        chmod 0600, $ldap_pwfile or die "chmod on $ldap_pwfile";
 
-       system_or_bail $slapd, '-f', $slapd_conf, '-h', "$ldap_url $ldaps_url";
+       # -s0 prevents log messages ending up in syslog
+       system_or_bail $slapd, '-f', $slapd_conf, '-s0', '-h', "$ldap_url $ldaps_url";
 
        # wait until slapd accepts requests
        my $retries = 0;