Red Hat Bugzilla – Bug 1184585
slaptest doesn't convert perlModuleConfig lines
Last modified: 2015-11-19 03:52:54 EST
Description of problem: When using the perl backend, slaptest doesn't convert perlModuleConfig lines from slapd.conf to slapd.d. [root@host-049 openldap]# cat perl/PerlConf.pm #!/usr/bin/perl package PerlConf; use strict; use warnings; use POSIX; use Data::Dumper; sub new { my $class = shift; my $this = {}; bless $this, $class; print {*STDERR} "PerlConf module loaded\n"; $this->{test} = 0; return $this; } sub init { my $this = shift; my $log = $this->{LOG}; if (!$this->{test}) { print {*STDERR} "FAIL Config option missing\n"; return 1; } else { print {*STDERR} "PASS Config option set\n"; } return 0; } sub search { my $this = shift; my ( $base, $scope, $deref, $sizeLim, $timeLim, $filter, $attrOnly, @attrs ) = @_; my @match_entries = (); return ( 0, @match_entries ); } sub config { my $this = shift; my $log = $this->{LOG}; my (@args) = @_; print {*STDERR} "config\n"; my $test = shift @args; if ($test eq "ItWorked") { print {*STDERR} "GOOD Config option found\n"; $this->{test} = 1; return 0; } print {*STDERR} "FAIL Config option missing\n"; return 1; } 1; [root@host-049 openldap]# cat slapd.conf include /etc/openldap/schema/core.schema pidfile /var/run/openldap/slapd.pid argsfile /var/run/openldap/slapd.args moduleload back_perl.la database perl perlModulePath /etc/openldap/perl perlModule PerlConf perlModuleConfig ItWorked suffix "dc=perl,dc=test" rootdn "cn=Manager,dc=perl,dc=test" Version-Release number of selected component (if applicable): openldap-servers-2.4.39-6.el7.x86_64 How reproducible: Easily Steps to Reproduce: 1. copy PerlConf.pm from above to /etc/openldap/perl 2. copy slapd.conf from above to /etc/openldap 3. slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d 4. chown -R ldap.ldap /etc/openldap/slapd.d 5. restorecon -R /etc/openldap/slapd.d 6. systemctl start slapd.service Actual results: [root@host-049 openldap]# rm -rf slapd.d [root@host-049 openldap]# ls certs check_password.conf ldap.conf perl schema slapd.conf [root@host-049 openldap]# slaptest -f slapd.conf PerlConf module loaded config GOOD Config option found PASS Config option set config file testing succeeded [root@host-049 openldap]# mkdir slapd.d [root@host-049 openldap]# slaptest -f slapd.conf -F slapd.d PerlConf module loaded config GOOD Config option found PASS Config option set config file testing succeeded [root@host-049 openldap]# chown -R ldap.ldap slapd.d [root@host-049 openldap]# restorecon -R slapd.d [root@host-049 openldap]# systemctl start slapd Job for slapd.service failed. See 'systemctl status slapd.service' and 'journalctl -xn' for details. [root@host-049 openldap]# systemctl status slapd slapd.service - OpenLDAP Server Daemon Loaded: loaded (/usr/lib/systemd/system/slapd.service; disabled) Active: failed (Result: exit-code) since Wed 2015-01-21 11:58:32 CST; 4s ago Docs: man:slapd man:slapd-config man:slapd-hdb man:slapd-mdb file:///usr/share/doc/openldap-servers/guide.html Process: 28874 ExecStart=/usr/sbin/slapd -u ldap -h ${SLAPD_URLS} $SLAPD_OPTIONS (code=exited, status=1/FAILURE) Process: 28861 ExecStartPre=/usr/libexec/openldap/check-config.sh (code=exited, status=0/SUCCESS) Jan 21 11:58:32 host-049.virt.lab.msp.redhat.com systemd[1]: Starting OpenLDAP Server Daemon... Jan 21 11:58:32 host-049.virt.lab.msp.redhat.com runuser[28864]: pam_unix(runuser:session): session opened for user ldap by (uid=0) Jan 21 11:58:32 host-049.virt.lab.msp.redhat.com slapd[28874]: @(#) $OpenLDAP: slapd 2.4.39 (Dec 9 2014 03:55:47) $ mockbuild@x86-030.build.eng.bos.redhat.com:/builddir/build/BUILD/openldap-2.4.39/openldap-2.4.39/servers/slapd Jan 21 11:58:32 host-049.virt.lab.msp.redhat.com slapd[28874]: PerlConf module loaded Jan 21 11:58:32 host-049.virt.lab.msp.redhat.com systemd[1]: slapd.service: control process exited, code=exited status=1 Jan 21 11:58:32 host-049.virt.lab.msp.redhat.com systemd[1]: Failed to start OpenLDAP Server Daemon. Jan 21 11:58:32 host-049.virt.lab.msp.redhat.com systemd[1]: Unit slapd.service entered failed state. Expected results: The config token ItWorked should be found in /etc/openldap/slapd.d and the perl module should see the config option when slapd starts as a service. Additional info:
Created attachment 1014301 [details] patch v1
I don't think this is working correctly with multiple args. perlModuleConfig homedir /mnt/nate0 gets converted to olcPerlModuleConfig: homedir olcPerlModuleConfig: /mnt/nate0 Which is then fed to the module in separate calls. Apr 15 11:12:41 host-057 slapd: Setting config option homedir: /home -> Apr 15 11:12:41 host-057 slapd: Not a valid config option: /mnt/nate0
Created attachment 1018437 [details] patch v2
Created attachment 1019260 [details] patch v3
The patch is now committed upstream: http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=commitdiff;h=fb1bf1caa82aa75eb5924e8c338da11f47854408
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2015-2131.html