Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1184585 - slaptest doesn't convert perlModuleConfig lines
slaptest doesn't convert perlModuleConfig lines
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: openldap (Show other bugs)
7.1
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Matus Honek
Patrik Kis
: EasyFix, Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-01-21 13:01 EST by Nate Straz
Modified: 2015-11-19 03:52 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: missing code that should handle converting perlModulConfig lines Consequence: these lines were ignored running slaptest Fix: fixed by adding logic to code Result: slaptest now correctly converts the lines
Story Points: ---
Clone Of:
: 1211890 (view as bug list)
Environment:
Last Closed: 2015-11-19 03:52:54 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch v1 (801 bytes, patch)
2015-04-14 09:02 EDT, Jan Synacek
no flags Details | Diff
patch v2 (1.53 KB, patch)
2015-04-24 08:09 EDT, Jan Synacek
no flags Details | Diff
patch v3 (1.18 KB, patch)
2015-04-27 03:34 EDT, Jan Synacek
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
OpenLDAP ITS 8105 None None None Never
Red Hat Product Errata RHSA-2015:2131 normal SHIPPED_LIVE Moderate: openldap security, bug fix, and enhancement update 2015-11-19 04:10:21 EST

  None (edit)
Description Nate Straz 2015-01-21 13:01:56 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:
Comment 2 Jan Synacek 2015-04-14 09:02:50 EDT
Created attachment 1014301 [details]
patch v1
Comment 5 Nate Straz 2015-04-15 12:12:57 EDT
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
Comment 6 Jan Synacek 2015-04-24 08:09:00 EDT
Created attachment 1018437 [details]
patch v2
Comment 7 Jan Synacek 2015-04-27 03:34:15 EDT
Created attachment 1019260 [details]
patch v3
Comment 13 errata-xmlrpc 2015-11-19 03:52:54 EST
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

Note You need to log in before you can comment on or make changes to this bug.