Submitted by:            Armin K. <krejzi at email dot com>
Updated by:              Bruce Dubbs <bdubbs at linuxfromscratch.org>
Date:                    2012-04-06 (Updated 2015-03-24)
Initial Package Version: 2.4.30
Upstream Status:         BLFS Specific
Origin:                  Self
Description:             Patch changes various installation options, such as ldap database path,
                         configuration file options, slapd install location, etc.
Update:                  Remove reference to bdb module

diff -Naur openldap-2.4.40.orig/doc/man/man5/slapd-bdb.5 openldap-2.4.40/doc/man/man5/slapd-bdb.5
--- openldap-2.4.40.orig/doc/man/man5/slapd-bdb.5	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/doc/man/man5/slapd-bdb.5	2015-01-06 17:18:59.043559984 +0100
@@ -135,7 +135,7 @@
 associated indexes live.
 A separate directory must be specified for each database.
 The default is
-.BR LOCALSTATEDIR/openldap\-data .
+.BR LOCALSTATEDIR/lib/openldap .
 .TP
 .B dirtyread
 Allow reads of modified but not yet committed data.
diff -Naur openldap-2.4.40.orig/doc/man/man5/slapd.conf.5 openldap-2.4.40/doc/man/man5/slapd.conf.5
--- openldap-2.4.40.orig/doc/man/man5/slapd.conf.5	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/doc/man/man5/slapd.conf.5	2015-01-06 17:18:59.044559938 +0100
@@ -2021,7 +2021,7 @@
 # The database directory MUST exist prior to
 # running slapd AND should only be accessible
 # by the slapd/tools. Mode 0700 recommended.
-directory LOCALSTATEDIR/openldap\-data
+directory LOCALSTATEDIR/lib/openldap
 # Indices to maintain
 index     objectClass  eq
 index     cn,sn,mail   pres,eq,approx,sub
diff -Naur openldap-2.4.40.orig/doc/man/man5/slapd-config.5 openldap-2.4.40/doc/man/man5/slapd-config.5
--- openldap-2.4.40.orig/doc/man/man5/slapd-config.5	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/doc/man/man5/slapd-config.5	2015-01-06 17:18:59.045559892 +0100
@@ -2051,7 +2051,7 @@
 # The database directory MUST exist prior to
 # running slapd AND should only be accessible
 # by the slapd/tools. Mode 0700 recommended.
-olcDbDirectory: LOCALSTATEDIR/openldap\-data
+olcDbDirectory: LOCALSTATEDIR/lib/openldap
 # Indices to maintain
 olcDbIndex:     objectClass  eq
 olcDbIndex:     cn,sn,mail   pres,eq,approx,sub
diff -Naur openldap-2.4.40.orig/include/ldap_defaults.h openldap-2.4.40/include/ldap_defaults.h
--- openldap-2.4.40.orig/include/ldap_defaults.h	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/include/ldap_defaults.h	2015-01-06 17:18:59.045559892 +0100
@@ -39,7 +39,7 @@
 #define LDAP_ENV_PREFIX "LDAP"
 
 /* default ldapi:// socket */
-#define LDAPI_SOCK LDAP_RUNDIR LDAP_DIRSEP "run" LDAP_DIRSEP "ldapi"
+#define LDAPI_SOCK LDAP_RUNDIR LDAP_DIRSEP "run" LDAP_DIRSEP "openldap" LDAP_DIRSEP "ldapi"
 
 /*
  * SLAPD DEFINITIONS
@@ -47,7 +47,7 @@
 	/* location of the default slapd config file */
 #define SLAPD_DEFAULT_CONFIGFILE	LDAP_SYSCONFDIR LDAP_DIRSEP "slapd.conf"
 #define SLAPD_DEFAULT_CONFIGDIR		LDAP_SYSCONFDIR LDAP_DIRSEP "slapd.d"
-#define SLAPD_DEFAULT_DB_DIR		LDAP_RUNDIR LDAP_DIRSEP "openldap-data"
+#define SLAPD_DEFAULT_DB_DIR		LDAP_RUNDIR LDAP_DIRSEP "lib" LDAP_DIRSEP "openldap"
 #define SLAPD_DEFAULT_DB_MODE		0600
 #define SLAPD_DEFAULT_UCDATA		LDAP_DATADIR LDAP_DIRSEP "ucdata"
 	/* default max deref depth for aliases */
diff -Naur openldap-2.4.40.orig/libraries/liblber/Makefile.in openldap-2.4.40/libraries/liblber/Makefile.in
--- openldap-2.4.40.orig/libraries/liblber/Makefile.in	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/libraries/liblber/Makefile.in	2015-01-06 17:18:59.045559892 +0100
@@ -48,6 +48,6 @@
 
 install-local: FORCE
 	-$(MKDIR) $(DESTDIR)$(libdir)
-	$(LTINSTALL) $(INSTALLFLAGS) -m 644 $(LIBRARY) $(DESTDIR)$(libdir)
+	$(LTINSTALL) $(INSTALLFLAGS) -m 755 $(LIBRARY) $(DESTDIR)$(libdir)
 	$(LTFINISH) $(DESTDIR)$(libdir)
 
diff -Naur openldap-2.4.40.orig/libraries/libldap/Makefile.in openldap-2.4.40/libraries/libldap/Makefile.in
--- openldap-2.4.40.orig/libraries/libldap/Makefile.in	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/libraries/libldap/Makefile.in	2015-01-06 17:18:59.046559846 +0100
@@ -68,7 +68,7 @@
 
 install-local: $(CFFILES) FORCE
 	-$(MKDIR) $(DESTDIR)$(libdir)
-	$(LTINSTALL) $(INSTALLFLAGS) -m 644 $(LIBRARY) $(DESTDIR)$(libdir)
+	$(LTINSTALL) $(INSTALLFLAGS) -m 755 $(LIBRARY) $(DESTDIR)$(libdir)
 	$(LTFINISH) $(DESTDIR)$(libdir)
 	-$(MKDIR) $(DESTDIR)$(sysconfdir)
 	@for i in $(CFFILES); do \
diff -Naur openldap-2.4.40.orig/libraries/libldap_r/Makefile.in openldap-2.4.40/libraries/libldap_r/Makefile.in
--- openldap-2.4.40.orig/libraries/libldap_r/Makefile.in	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/libraries/libldap_r/Makefile.in	2015-01-06 17:18:59.046559846 +0100
@@ -83,6 +83,6 @@
 
 install-local: $(CFFILES) FORCE
 	-$(MKDIR) $(DESTDIR)$(libdir)
-	$(LTINSTALL) $(INSTALLFLAGS) -m 644 $(LIBRARY) $(DESTDIR)$(libdir)
+	$(LTINSTALL) $(INSTALLFLAGS) -m 755 $(LIBRARY) $(DESTDIR)$(libdir)
 	$(LTFINISH) $(DESTDIR)$(libdir)
 
diff -Naur openldap-2.4.40.orig/servers/slapd/Makefile.in openldap-2.4.40/servers/slapd/Makefile.in
--- openldap-2.4.40.orig/servers/slapd/Makefile.in	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/servers/slapd/Makefile.in	2015-01-06 17:18:59.047559800 +0100
@@ -376,10 +376,10 @@
 	install-conf install-dbc-maybe install-schema install-tools
 
 install-slapd: FORCE
-	-$(MKDIR) $(DESTDIR)$(libexecdir)
+	-$(MKDIR) $(DESTDIR)$(sbindir)
 	-$(MKDIR) $(DESTDIR)$(localstatedir)/run
 	$(LTINSTALL) $(INSTALLFLAGS) $(STRIP) -m 755 \
-		slapd$(EXEEXT) $(DESTDIR)$(libexecdir)
+		slapd$(EXEEXT) $(DESTDIR)$(sbindir)
 	@for i in $(SUBDIRS); do \
 	    if test -d $$i && test -f $$i/Makefile ; then \
 		echo; echo "  cd $$i; $(MAKE) $(MFLAGS) install"; \
@@ -445,9 +445,9 @@
 
 install-db-config: FORCE
 	@-$(MKDIR) $(DESTDIR)$(localstatedir) $(DESTDIR)$(sysconfdir)
-	@-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/openldap-data
+	@-$(INSTALL) -m 700 -d $(DESTDIR)$(localstatedir)/lib/openldap
 	$(INSTALL) $(INSTALLFLAGS) -m 600 $(srcdir)/DB_CONFIG \
-		$(DESTDIR)$(localstatedir)/openldap-data/DB_CONFIG.example
+		$(DESTDIR)$(localstatedir)/lib/openldap/DB_CONFIG.example
 	$(INSTALL) $(INSTALLFLAGS) -m 600 $(srcdir)/DB_CONFIG \
 		$(DESTDIR)$(sysconfdir)/DB_CONFIG.example
 
@@ -455,6 +455,6 @@
 	-$(MKDIR) $(DESTDIR)$(sbindir)
 	for i in $(SLAPTOOLS); do \
 		$(RM) $(DESTDIR)$(sbindir)/$$i$(EXEEXT); \
-		$(LN_S) -f $(DESTDIR)$(libexecdir)/slapd$(EXEEXT) $(DESTDIR)$(sbindir)/$$i$(EXEEXT); \
+		$(LN_S) -f $(DESTDIR)$(sbindir)/slapd$(EXEEXT) $(DESTDIR)$(sbindir)/$$i$(EXEEXT); \
 	done
 
diff -Naur openldap-2.4.40.orig/servers/slapd/slapd.conf openldap-2.4.40/servers/slapd/slapd.conf
--- openldap-2.4.40.orig/servers/slapd/slapd.conf	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/servers/slapd/slapd.conf	2015-01-06 17:18:59.047559800 +0100
@@ -10,14 +10,12 @@
 # service AND an understanding of referrals.
 #referral	ldap://root.openldap.org
 
-pidfile		%LOCALSTATEDIR%/run/slapd.pid
-argsfile	%LOCALSTATEDIR%/run/slapd.args
+pidfile		%LOCALSTATEDIR%/run/openldap/slapd.pid
+argsfile	%LOCALSTATEDIR%/run/openldap/slapd.args
 
 # Load dynamic backend modules:
-# modulepath	%MODULEDIR%
-# moduleload	back_bdb.la
-# moduleload	back_hdb.la
-# moduleload	back_ldap.la
+modulepath	%MODULEDIR%
+#moduleload	back_bdb
 
 # Sample security restrictions
 #	Require integrity protection (prevent hijacking)
@@ -46,20 +44,26 @@
 #
 # rootdn can always read and write EVERYTHING!
 
+# Specific Backend Directives for bdb:
+backend         bdb
+
 #######################################################################
 # BDB database definitions
 #######################################################################
 
 database	bdb
 suffix		"dc=my-domain,dc=com"
-rootdn		"cn=Manager,dc=my-domain,dc=com"
+#rootdn		"cn=Manager,dc=my-domain,dc=com"
+
 # Cleartext passwords, especially for the rootdn, should
 # be avoid.  See slappasswd(8) and slapd.conf(5) for details.
 # Use of strong authentication encouraged.
-rootpw		secret
+#rootpw		secret
+
 # The database directory MUST exist prior to running slapd AND 
 # should only be accessible by the slapd and slap tools.
 # Mode 700 recommended.
-directory	%LOCALSTATEDIR%/openldap-data
+directory	%LOCALSTATEDIR%/lib/openldap
+
 # Indices to maintain
 index	objectClass	eq
diff -Naur openldap-2.4.40.orig/servers/slapd/slapi/Makefile.in openldap-2.4.40/servers/slapd/slapi/Makefile.in
--- openldap-2.4.40.orig/servers/slapd/slapi/Makefile.in	2014-09-19 03:48:49.000000000 +0200
+++ openldap-2.4.40/servers/slapd/slapi/Makefile.in	2015-01-06 17:18:59.047559800 +0100
@@ -46,6 +46,6 @@
 install-local: FORCE
 	if test "$(BUILD_MOD)" = "yes"; then \
 		$(MKDIR) $(DESTDIR)$(libdir); \
-		$(LTINSTALL) $(INSTALLFLAGS) -m 644 $(LIBRARY) $(DESTDIR)$(libdir); \
+		$(LTINSTALL) $(INSTALLFLAGS) -m 755 $(LIBRARY) $(DESTDIR)$(libdir); \
 	fi
 
