In Fedora 14, 389-ds started linking against openldap libraries instead
of the old mozldap libraries.

This patch allows us to conditionally build plugins against openldap as
well. Failure to do so may cause symbol clashes when the plugin is used
by directory server because then we get 2 different ldap libraries
loaded at the same time.

The spec file has already been changed to build plugins --with-openldap
by default.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
>From 4bdfe38e0ce4f2aaeb07ac43880ca87cd30f9d57 Mon Sep 17 00:00:00 2001
From: Simo Sorce <sso...@redhat.com>
Date: Fri, 3 Dec 2010 15:02:29 -0500
Subject: [PATCH] Make use of mozldap vs openldap for plugins selectable

---
 daemons/configure.ac                               |   21 ++++++++++++++++---
 .../ipa-slapi-plugins/ipa-enrollment/Makefile.am   |    4 +-
 daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am   |    4 +-
 .../ipa-slapi-plugins/ipa-pwd-extop/Makefile.am    |    4 +-
 daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h   |    2 +
 .../ipa-pwd-extop/ipapwd_common.c                  |    4 +-
 daemons/ipa-slapi-plugins/ipa-uuid/Makefile.am     |    4 +-
 daemons/ipa-slapi-plugins/ipa-version/Makefile.am  |    4 +-
 daemons/ipa-slapi-plugins/ipa-winsync/Makefile.am  |    4 +-
 .../ipa-slapi-plugins/ipa-winsync/ipa-winsync.c    |    3 ++
 ipa.spec.in                                        |    4 +++
 11 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/daemons/configure.ac b/daemons/configure.ac
index d959f987a49f4cefb1c96fd86d89ce1b4749f7aa..221a63a7f4dca8352b41874c777469cadc685d7a 100644
--- a/daemons/configure.ac
+++ b/daemons/configure.ac
@@ -137,11 +137,9 @@ fi
 AC_SUBST(KRB5_LIBS)
 
 dnl ---------------------------------------------------------------------------
-dnl - Check for Mozilla LDAP *and* OpenLDAP SDK
+dnl - Check for Mozilla LDAP and OpenLDAP SDK
 dnl ---------------------------------------------------------------------------
 
-dnl The mozldap libraries are always needed because ipa-slapi-plugins/dna/ 
-dnl will not build against OpenLDAP.
 SAVE_CPPFLAGS=$CPPFLAGS
 CPPFLAGS="$NSPR4 $NSS3"
 AC_CHECK_HEADER(svrcore.h)
@@ -193,6 +191,21 @@ AC_SUBST(OPENLDAP_LIBS)
 OPENLDAP_CFLAGS="${OPENLDAP_CFLAGS} -DWITH_OPENLDAP"
 AC_SUBST(OPENLDAP_CFLAGS)
 
+AC_ARG_WITH([openldap],
+            [AS_HELP_STRING([--with-openldap],
+                            [compile plugins with openldap instead of mozldap])],
+            [], [])
+
+if test "x$with_openldap" == xyes; then
+    LDAP_CFLAGS="${OPENLDAP_CFLAGS} $NSPR4 $NSS3 -DUSE_OPENLDAP"
+    LDAP_LIBS="${OPENLDAP_LIBS}"
+else
+    LDAP_CFLAGS="${MOZLDAP_CFLAGS}"
+    LDAP_LIBS="${MOZLDAP_LIBS}"
+fi
+AC_SUBST(LDAP_CFLAGS)
+AC_SUBST(LDAP_LIBS)
+
 dnl ---------------------------------------------------------------------------
 dnl - Check for OpenSSL Crypto library
 dnl ---------------------------------------------------------------------------
@@ -312,7 +325,7 @@ echo "
 	source code location:	  ${srcdir}
 	compiler:		  ${CC}
 	cflags:		          ${CFLAGS}
-        LDAP libs:                ${OPENLDAP_LIBS}
+        LDAP libs:                ${LDAP_LIBS}
         KRB5 libs:                ${KRB5_LIBS}
         OpenSSL libs:             ${SSL_LIBS}
         Maintainer mode:          ${USE_MAINTAINER_MODE}
diff --git a/daemons/ipa-slapi-plugins/ipa-enrollment/Makefile.am b/daemons/ipa-slapi-plugins/ipa-enrollment/Makefile.am
index d041815a2693a990431e2f42d22d0ae6ad5024fa..c3bb279598cc6eafbaa545ef0774882d2fe98a1e 100644
--- a/daemons/ipa-slapi-plugins/ipa-enrollment/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-enrollment/Makefile.am
@@ -12,7 +12,7 @@ INCLUDES =							\
 	-DLIBEXECDIR=\""$(libexecdir)"\"			\
 	-DDATADIR=\""$(datadir)"\"				\
 	$(AM_CFLAGS)						\
-	$(MOZLDAP_CFLAGS)					\
+	$(LDAP_CFLAGS)					\
 	$(KRB5_CFLAGS)						\
 	$(WARN_CFLAGS)						\
 	$(NULL)
@@ -29,7 +29,7 @@ libipa_enrollment_extop_la_SOURCES = 	\
 libipa_enrollment_extop_la_LDFLAGS = -avoid-version
 
 libipa_enrollment_extop_la_LIBADD = 	\
-	$(MOZLDAP_LIBS)			\
+	$(LDAP_LIBS)			\
 	$(NULL)
 
 appdir = $(IPA_DATA_DIR)
diff --git a/daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am b/daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am
index b7986874822690422f015b1d39454c2ed9995340..5d9db51f41c427894961d8af2b9b6b8d4d289ae0 100644
--- a/daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-modrdn/Makefile.am
@@ -13,7 +13,7 @@ INCLUDES =							\
 	-DLIBEXECDIR=\""$(libexecdir)"\"			\
 	-DDATADIR=\""$(datadir)"\"				\
 	$(AM_CFLAGS)						\
-	$(MOZLDAP_CFLAGS)					\
+	$(LDAP_CFLAGS)					\
 	$(WARN_CFLAGS)						\
 	$(NULL)
 
@@ -29,7 +29,7 @@ libipa_modrdn_la_SOURCES = 	\
 libipa_modrdn_la_LDFLAGS = -avoid-version
 
 libipa_modrdn_la_LIBADD = 	\
-	$(MOZLDAP_LIBS)		\
+	$(LDAP_LIBS)		\
 	$(NULL)
 
 appdir = $(IPA_DATA_DIR)
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am b/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am
index 41d9f237850a485371a60722d8ad54e4dab133ef..1daf942dab5caaf744902cac20c64f9df6ef2482 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/Makefile.am
@@ -15,7 +15,7 @@ INCLUDES =							\
 	-DLIBEXECDIR=\""$(libexecdir)"\"			\
 	-DDATADIR=\""$(datadir)"\"				\
 	$(AM_CFLAGS)						\
-	$(MOZLDAP_CFLAGS)					\
+	$(LDAP_CFLAGS)					\
 	$(KRB5_CFLAGS)						\
 	$(SSL_CFLAGS)						\
 	$(WARN_CFLAGS)						\
@@ -39,7 +39,7 @@ libipa_pwd_extop_la_LDFLAGS = -avoid-version
 libipa_pwd_extop_la_LIBADD = 		\
 	$(KRB5_LIBS)			\
 	$(SSL_LIBS)			\
-	$(MOZLDAP_LIBS)			\
+	$(LDAP_LIBS)			\
 	$(NULL)
 
 appdir = $(IPA_DATA_DIR)
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h
index bc521071e908cbc4f4288fcb3542372ca79e26ba..28833eaf9c5e7a3b3b1e8ed2dbe16096cdb8acbf 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h
@@ -49,6 +49,8 @@
 #include <unistd.h>
 #include <stdbool.h>
 
+#define LDAP_DEPRECATED 1
+
 #include <prio.h>
 #include <ssl.h>
 #include <dirsrv/slapi-plugin.h>
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c
index 31ecb1e4251c5bea1cb30bcbd64d5a7ec42e3ed1..acb5cdbccfb2b799551d9f43486584b902c79f50 100644
--- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c
+++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd_common.c
@@ -206,8 +206,8 @@ static struct ipapwd_krbcfg *ipapwd_getConfig(void)
         goto free_and_error;
     }
 
-    be = ber_init(bval);
-    if (!bval) {
+    be = ber_init(discard_const(bval));
+    if (!be) {
         LOG_FATAL("ber_init() failed!\n");
         goto free_and_error;
     }
diff --git a/daemons/ipa-slapi-plugins/ipa-uuid/Makefile.am b/daemons/ipa-slapi-plugins/ipa-uuid/Makefile.am
index 7c3709b5a4d88f48e46aa67cfc054aa01e1a5599..15e6dedb860e4bb0ba7554b13e21e18c27b68ef3 100644
--- a/daemons/ipa-slapi-plugins/ipa-uuid/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-uuid/Makefile.am
@@ -13,7 +13,7 @@ INCLUDES =							\
 	-DLIBEXECDIR=\""$(libexecdir)"\"			\
 	-DDATADIR=\""$(datadir)"\"				\
 	$(AM_CFLAGS)						\
-	$(MOZLDAP_CFLAGS)					\
+	$(LDAP_CFLAGS)					\
 	$(WARN_CFLAGS)						\
 	$(NULL)
 
@@ -29,7 +29,7 @@ libipa_uuid_la_SOURCES = 	\
 libipa_uuid_la_LDFLAGS = -avoid-version
 
 libipa_uuid_la_LIBADD = 	\
-	$(MOZLDAP_LIBS)		\
+	$(LDAP_LIBS)		\
 	$(UUID_LIBS)		\
 	$(NULL)
 
diff --git a/daemons/ipa-slapi-plugins/ipa-version/Makefile.am b/daemons/ipa-slapi-plugins/ipa-version/Makefile.am
index d26a7d24eca5f4ca6de6e7906e462d165b657d14..c7317ecdf7ac3caeec1ad72fee96f1a03cc6322d 100644
--- a/daemons/ipa-slapi-plugins/ipa-version/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-version/Makefile.am
@@ -14,7 +14,7 @@ INCLUDES =							\
 	-DLIBEXECDIR=\""$(libexecdir)"\"			\
 	-DDATADIR=\""$(datadir)"\"				\
 	$(AM_CFLAGS)						\
-	$(MOZLDAP_CFLAGS)					\
+	$(LDAP_CFLAGS)					\
 	$(KRB5_CFLAGS)						\
 	$(WARN_CFLAGS)						\
 	$(NULL)
@@ -31,7 +31,7 @@ libipa_repl_version_la_SOURCES = 	\
 libipa_repl_version_la_LDFLAGS = -avoid-version
 
 libipa_repl_version_la_LIBADD = 	\
-	$(MOZLDAP_LIBS)			\
+	$(LDAP_LIBS)			\
 	$(NULL)
 
 appdir = $(IPA_DATA_DIR)
diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/Makefile.am b/daemons/ipa-slapi-plugins/ipa-winsync/Makefile.am
index 82a934a220598399569e6cb9ad80c5b9e751b365..2d4b5a4472eda86c9f59797635eb216082431882 100644
--- a/daemons/ipa-slapi-plugins/ipa-winsync/Makefile.am
+++ b/daemons/ipa-slapi-plugins/ipa-winsync/Makefile.am
@@ -12,7 +12,7 @@ INCLUDES =							\
 	-DLIBEXECDIR=\""$(libexecdir)"\"			\
 	-DDATADIR=\""$(datadir)"\"				\
 	$(AM_CFLAGS)						\
-	$(MOZLDAP_CFLAGS)					\
+	$(LDAP_CFLAGS)					\
 	$(WARN_CFLAGS)						\
 	$(NULL)
 
@@ -29,7 +29,7 @@ libipa_winsync_la_SOURCES = 		\
 libipa_winsync_la_LDFLAGS = -avoid-version
 
 #libipa_winsync_la_LIBADD = 		\
-#	$(MOZLDAP_LIBS)			\
+#	$(LDAP_LIBS)			\
 #	$(NULL)
 
 appdir = $(IPA_DATA_DIR)
diff --git a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c
index ecdda238f2fc1cd22be74845244e7eaecc19c43a..9fe213158c5877e04340ec0b45f065e833f85029 100644
--- a/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c
+++ b/daemons/ipa-slapi-plugins/ipa-winsync/ipa-winsync.c
@@ -41,6 +41,8 @@
 #  include <config.h>
 #endif
 
+#define LDAP_DEPRECATED 1
+
 /*
  * Windows Synchronization Plug-in for IPA
  * This plugin allows IPA to intercept operations sent from
@@ -60,6 +62,7 @@
 #include "ipa-winsync.h"
 
 #include <string.h>
+#include <stdlib.h>
 #include "plstr.h"
 
 static void
diff --git a/ipa.spec.in b/ipa.spec.in
index 8bc636f3cb26ec5bcabe5b3b1d9e52bca7a46292..2597dad85d2f4b3ab8b876fe0adec27b41651a70 100644
--- a/ipa.spec.in
+++ b/ipa.spec.in
@@ -226,7 +226,11 @@ export CPPFLAGS="$CPPFLAGS %{optflags}"
 make version-update
 cd ipa-client; ../autogen.sh --prefix=%{_usr} --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} --libdir=%{_libdir} --mandir=%{_mandir}; cd ..
 %if ! %{ONLY_CLIENT}
+%if 0%{?fedora} >= 14
+cd daemons; ../autogen.sh --prefix=%{_usr} --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} --libdir=%{_libdir} --mandir=%{_mandir} --with-openldap; cd ..
+%else
 cd daemons; ../autogen.sh --prefix=%{_usr} --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} --libdir=%{_libdir} --mandir=%{_mandir}; cd ..
+%endif
 cd install; ../autogen.sh --prefix=%{_usr} --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} --libdir=%{_libdir} --mandir=%{_mandir}; cd ..
 %endif
 
-- 
1.7.3.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to