Submitted by:            Bruce Dubbs <bdubbs at linuxfromscratch.org>
Date:                    2012-03-26
Initial Package Version: 2.4.40
Upstream Status:         BLFS Specific
Origin:                  Armin K. <krejzi at email dot com> and Debian
Comment:                 Rediffed by Fernando de Oliveira <famobr at yahoo dot
                         com dot br> for version 2.4.44 - 2016.02.06
                         Rediffed by Pierre Labastie <pierre dot labastie at
                         neuf dot fr> to add mdb backend and slapd.ldif. See
                         ticket #7394 - 2016.02.24
                         Rediffed by Douglas R. Reno <renodr at linuxfromscratch
                         dot org> to function on 2.4.51. - 2020-08-13
                         Fixed the rediff to use a .c file instead of a .s, fixing
                         the test by Douglas R. Reno - 2020-08-13
                         Rediffed by Tim Tassonis <stuff at decentral.ch> to
                         remove now integrated symbol versioning stuff and
                         remove changes to now non-existent slapd-bdb.5 file
Description:             Consolidate earlier patches to:
 1. Update various installation options, such as ldap database path,
    configuration file options, slapd install location, etc.
 2. Remove reference to bdb module

diff -Naurp openldap-2.5.4.orig/doc/man/man5/slapd.conf.5 openldap-2.5.4/doc/man/man5/slapd.conf.5
--- openldap-2.5.4.orig/doc/man/man5/slapd.conf.5	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/doc/man/man5/slapd.conf.5	2021-04-30 14:24:16.780840972 +0200
@@ -2087,7 +2087,7 @@ suffix    "dc=our\-domain,dc=com"
 # 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 -Naurp openldap-2.5.4.orig/doc/man/man5/slapd-config.5 openldap-2.5.4/doc/man/man5/slapd-config.5
--- openldap-2.5.4.orig/doc/man/man5/slapd-config.5	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/doc/man/man5/slapd-config.5	2021-04-30 14:24:52.173843041 +0200
@@ -2196,7 +2196,7 @@ olcSuffix: "dc=our\-domain,dc=com"
 # 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 -Naurp openldap-2.5.4.orig/include/ldap_defaults.h openldap-2.5.4/include/ldap_defaults.h
--- openldap-2.5.4.orig/include/ldap_defaults.h	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/include/ldap_defaults.h	2021-04-30 14:26:05.399847328 +0200
@@ -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 -Naurp openldap-2.5.4.orig/libraries/liblber/Makefile.in openldap-2.5.4/libraries/liblber/Makefile.in
--- openldap-2.5.4.orig/libraries/liblber/Makefile.in	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/libraries/liblber/Makefile.in	2021-04-30 14:26:40.598849371 +0200
@@ -51,6 +51,6 @@ idtest:  $(XLIBS) idtest.o
 
 install-local: FORCE
 	-$(MKDIR) $(DESTDIR)$(libdir)
-	$(LTINSTALL) $(INSTALLFLAGS) -m 644 $(LIBRARY) $(DESTDIR)$(libdir)
+	$(LTINSTALL) $(INSTALLFLAGS) -m 755 $(LIBRARY) $(DESTDIR)$(libdir)
 	$(LTFINISH) $(DESTDIR)$(libdir)
 
diff -Naurp openldap-2.5.4.orig/libraries/libldap/Makefile.in openldap-2.5.4/libraries/libldap/Makefile.in
--- openldap-2.5.4.orig/libraries/libldap/Makefile.in	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/libraries/libldap/Makefile.in	2021-04-30 14:27:20.877851683 +0200
@@ -82,7 +82,7 @@ CFFILES=ldap.conf
 
 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 -Naurp openldap-2.5.4.orig/servers/slapd/Makefile.in openldap-2.5.4/servers/slapd/Makefile.in
--- openldap-2.5.4.orig/servers/slapd/Makefile.in	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/servers/slapd/Makefile.in	2021-04-30 14:31:04.037860823 +0200
@@ -374,9 +374,10 @@ install-local-srv: install-slapd install
 
 install-slapd: FORCE
 	-$(MKDIR) $(DESTDIR)$(libexecdir)
+	-$(MKDIR) $(DESTDIR)$(sbindir)
 	-$(MKDIR) $(DESTDIR)$(localstatedir)/run
 	$(LTINSTALL) $(INSTALLFLAGS) $(STRIP_OPTS) -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"; \
@@ -452,9 +453,9 @@ install-conf: FORCE
 
 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
 
@@ -462,6 +463,6 @@ install-tools: FORCE
 	-$(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 -Naurp openldap-2.5.4.orig/servers/slapd/slapd.conf openldap-2.5.4/servers/slapd/slapd.conf
--- openldap-2.5.4.orig/servers/slapd/slapd.conf	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/servers/slapd/slapd.conf	2021-04-30 14:32:53.748864629 +0200
@@ -10,12 +10,13 @@ include		%SYSCONFDIR%/schema/core.schema
 # 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_mdb.la
+modulepath %MODULEDIR%
+moduleload back_mdb.la
 # moduleload	back_ldap.la
 
 # Sample security restrictions
@@ -69,7 +70,7 @@ 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 -Naurp openldap-2.5.4.orig/servers/slapd/slapd.ldif openldap-2.5.4/servers/slapd/slapd.ldif
--- openldap-2.5.4.orig/servers/slapd/slapd.ldif	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/servers/slapd/slapd.ldif	2021-04-30 14:35:53.714870855 +0200
@@ -9,8 +9,9 @@ cn: config
 #
 # Define global ACLs to disable default read access.
 #
-olcArgsFile: %LOCALSTATEDIR%/run/slapd.args
-olcPidFile: %LOCALSTATEDIR%/run/slapd.pid
+olcArgsFile: %LOCALSTATEDIR%/run/openldap/slapd.args
+olcPidFile: %LOCALSTATEDIR%/run/openldap/slapd.pid
+
 #
 # Do not enable referrals until AFTER you have a working directory
 # service AND an understanding of referrals.
@@ -26,11 +27,11 @@ olcPidFile: %LOCALSTATEDIR%/run/slapd.pi
 #
 # Load dynamic backend modules:
 #
-#dn: cn=module,cn=config
-#objectClass: olcModuleList
-#cn: module
-#olcModulepath:	%MODULEDIR%
-#olcModuleload:	back_mdb.la
+dn: cn=module,cn=config
+objectClass: olcModuleList
+cn: module
+olcModulepath: %MODULEDIR%
+olcModuleload: back_mdb.la
 #olcModuleload:	back_ldap.la
 #olcModuleload:	back_passwd.la
 #olcModuleload:	back_shell.la
@@ -90,7 +91,7 @@ olcRootPW: secret
 # The database directory MUST exist prior to running slapd AND 
 # should only be accessible by the slapd and slap tools.
 # Mode 700 recommended.
-olcDbDirectory:	%LOCALSTATEDIR%/openldap-data
+olcDbDirectory:    %LOCALSTATEDIR%/lib/openldap
 # Indices to maintain
 olcDbIndex: objectClass eq
 
diff -Naurp openldap-2.5.4.orig/servers/slapd/slapi/Makefile.in openldap-2.5.4/servers/slapd/slapi/Makefile.in
--- openldap-2.5.4.orig/servers/slapd/slapi/Makefile.in	2021-04-29 19:42:58.000000000 +0200
+++ openldap-2.5.4/servers/slapd/slapi/Makefile.in	2021-04-30 14:37:22.004873907 +0200
@@ -46,6 +46,6 @@ BUILD_MOD = @BUILD_SLAPI@
 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
 
