Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 545792

Summary: net-nds/openldap-2.4.40-r3 incorrect checkconfig() in /etc/init.d/slapd
Product: Gentoo Linux Reporter: Dmitry A. Bakshaev <dab1818>
Component: Current packagesAssignee: Gentoo LDAP project <ldap-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: opensource
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: fix checkconfig()

Description Dmitry A. Bakshaev 2015-04-07 07:08:30 UTC
slapd do not start



Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/slapd -d start

Actual Results:  
...
+ CONF=/etc/openldap/slapd.conf
+ '[' -d /etc/openldap/slapd.conf ']'
++ eval awk '"/^(directory|olcDbDirectory:)/{print $2}"' /etc/openldap/slapd.conf
+++ awk '/^(directory|olcDbDirectory:)/{print }' /etc/openldap/slapd.conf
+ DBDIRS='directory /var/lib/openldap-ldbm'
+ for d in '$DBDIRS'
+ '[' '!' -d directory ']'
+ eerror 'Directory directory in config does not exist!'
 * Directory directory in config does not exist!
+ return 1
+ eerror 'There is a problem with your slapd.conf!'
 * There is a problem with your slapd.conf!
+ return 1
+ exit 1
 * ERROR: slapd failed to start


Expected Results:  
config file testing succeeded
 * Starting ldap-server ...           [ ok ]

file owner check with inverted logic
Comment 1 Dmitry A. Bakshaev 2015-04-07 07:11:01 UTC
Created attachment 400746 [details, diff]
fix checkconfig()
Comment 2 Marios Andreopoulos 2015-04-28 21:04:20 UTC
I can confirm this bug and part of the fix (line 51, DBDIRS assignment).

What's interesting is that running the offending line 51 from the init script on a bash terminal it returns the expected results. Only when it runs as an init script it returns the wrong results.

LINE 51: DBDIRS=`eval awk '"/^(directory|olcDbDirectory:)/{print \$2}"' $CONF`
From bash returns correctly the directory   : /var/lib/openldap-data
From init script returns the whole conf line: directory /var/lib/openldap-data
Comment 3 Patrick Lauer gentoo-dev 2015-07-13 07:41:25 UTC
+  13 Jul 2015; Patrick Lauer <patrick@gentoo.org> +files/slapd-initd-2.4.40-r2,
+  +openldap-2.4.40-r4.ebuild, -openldap-2.4.40-r3.ebuild:
+  Fix init script failure #545792