Andreas Schneider 4717df1
From 410b045c45006ae9c3f2bbcafb07d6ac8c615a56 Mon Sep 17 00:00:00 2001
Andreas Schneider 4717df1
From: Andreas Schneider <asn@samba.org>
Andreas Schneider 4717df1
Date: Mon, 28 Jan 2013 16:16:42 +0100
Andreas Schneider 4717df1
Subject: [PATCH 1/3] Rename pdb_ldap to pdb_ldapsam
Andreas Schneider 4717df1
Andreas Schneider 4717df1
This patch moves pdb_ldap to pdb_ldapsam unconditionally
Andreas Schneider 4717df1
and makes possible to load ldapsam.so dynamically
Andreas Schneider 4717df1
Andreas Schneider 4717df1
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Andreas Schneider 4717df1
---
Andreas Schneider 4717df1
 source3/passdb/pdb_ipa.c     |  2 +-
Andreas Schneider 4717df1
 source3/passdb/pdb_ldap.c    | 12 +++++++++---
Andreas Schneider 4717df1
 source3/passdb/pdb_ldap.h    |  4 ++--
Andreas Schneider 4717df1
 source3/passdb/pdb_nds.c     |  2 +-
Andreas Schneider 4717df1
 source3/passdb/wscript_build |  6 +++---
Andreas Schneider 4717df1
 source3/wscript              |  2 +-
Andreas Schneider 4717df1
 6 files changed, 17 insertions(+), 11 deletions(-)
Andreas Schneider 4717df1
Andreas Schneider 4717df1
diff --git a/source3/passdb/pdb_ipa.c b/source3/passdb/pdb_ipa.c
Andreas Schneider 4717df1
index d31b37f..a699aab 100644
Andreas Schneider 4717df1
--- a/source3/passdb/pdb_ipa.c
Andreas Schneider 4717df1
+++ b/source3/passdb/pdb_ipa.c
Andreas Schneider 4717df1
@@ -1446,7 +1446,7 @@ static NTSTATUS pdb_init_IPA_ldapsam(struct pdb_methods **pdb_method, const char
Andreas Schneider 4717df1
 	struct ldapsam_privates *ldap_state;
Andreas Schneider 4717df1
 	NTSTATUS status;
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
-	status = pdb_init_ldapsam(pdb_method, location);
Andreas Schneider 4717df1
+	status = pdb_ldapsam_init_common(pdb_method, location);
Andreas Schneider 4717df1
 	if (!NT_STATUS_IS_OK(status)) {
Andreas Schneider 4717df1
 		return status;
Andreas Schneider 4717df1
 	}
Andreas Schneider 4717df1
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
Andreas Schneider 4717df1
index ca35ef7..7ae9056 100644
Andreas Schneider 4717df1
--- a/source3/passdb/pdb_ldap.c
Andreas Schneider 4717df1
+++ b/source3/passdb/pdb_ldap.c
Andreas Schneider 4717df1
@@ -6462,7 +6462,8 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c
Andreas Schneider 4717df1
  Initialise the normal mode for pdb_ldap
Andreas Schneider 4717df1
  *********************************************************************/
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
-NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location)
Andreas Schneider 4717df1
+NTSTATUS pdb_ldapsam_init_common(struct pdb_methods **pdb_method,
Andreas Schneider 4717df1
+				 const char *location)
Andreas Schneider 4717df1
 {
Andreas Schneider 4717df1
 	NTSTATUS nt_status;
Andreas Schneider 4717df1
 	struct ldapsam_privates *ldap_state = NULL;
Andreas Schneider 4717df1
@@ -6611,11 +6612,16 @@ NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location)
Andreas Schneider 4717df1
 	return NT_STATUS_OK;
Andreas Schneider 4717df1
 }
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
-NTSTATUS pdb_ldap_init(void)
Andreas Schneider 4717df1
+NTSTATUS pdb_ldapsam_init(void)
Andreas Schneider 4717df1
 {
Andreas Schneider 4717df1
 	NTSTATUS nt_status;
Andreas Schneider 4717df1
-	if (!NT_STATUS_IS_OK(nt_status = smb_register_passdb(PASSDB_INTERFACE_VERSION, "ldapsam", pdb_init_ldapsam)))
Andreas Schneider 4717df1
+
Andreas Schneider 4717df1
+	nt_status = smb_register_passdb(PASSDB_INTERFACE_VERSION,
Andreas Schneider 4717df1
+					"ldapsam",
Andreas Schneider 4717df1
+					pdb_ldapsam_init_common);
Andreas Schneider 4717df1
+	if (!NT_STATUS_IS_OK(nt_status)) {
Andreas Schneider 4717df1
 		return nt_status;
Andreas Schneider 4717df1
+	}
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
 	/* Let pdb_nds register backends */
Andreas Schneider 4717df1
 	pdb_nds_init();
Andreas Schneider 4717df1
diff --git a/source3/passdb/pdb_ldap.h b/source3/passdb/pdb_ldap.h
Andreas Schneider 4717df1
index 1372f33..0420314 100644
Andreas Schneider 4717df1
--- a/source3/passdb/pdb_ldap.h
Andreas Schneider 4717df1
+++ b/source3/passdb/pdb_ldap.h
Andreas Schneider 4717df1
@@ -29,8 +29,8 @@
Andreas Schneider 4717df1
 /* The following definitions come from passdb/pdb_ldap.c  */
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
 const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver );
Andreas Schneider 4717df1
-NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location);
Andreas Schneider 4717df1
-NTSTATUS pdb_ldap_init(void);
Andreas Schneider 4717df1
+NTSTATUS pdb_ldapsam_init_common(struct pdb_methods **pdb_method, const char *location);
Andreas Schneider 4717df1
+NTSTATUS pdb_ldapsam_init(void);
Andreas Schneider 4717df1
 int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state,
Andreas Schneider 4717df1
                                   const char *user,
Andreas Schneider 4717df1
                                   LDAPMessage ** result,
Andreas Schneider 4717df1
diff --git a/source3/passdb/pdb_nds.c b/source3/passdb/pdb_nds.c
Andreas Schneider 4717df1
index cce4937..d7c16da 100644
Andreas Schneider 4717df1
--- a/source3/passdb/pdb_nds.c
Andreas Schneider 4717df1
+++ b/source3/passdb/pdb_nds.c
Andreas Schneider 4717df1
@@ -878,7 +878,7 @@ static NTSTATUS pdb_init_NDS_ldapsam_common(struct pdb_methods **pdb_method, con
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
 static NTSTATUS pdb_init_NDS_ldapsam(struct pdb_methods **pdb_method, const char *location)
Andreas Schneider 4717df1
 {
Andreas Schneider 4717df1
-	NTSTATUS nt_status = pdb_init_ldapsam(pdb_method, location);
Andreas Schneider 4717df1
+	NTSTATUS nt_status = pdb_ldapsam_init_common(pdb_method, location);
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
 	(*pdb_method)->name = "NDS_ldapsam";
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
diff --git a/source3/passdb/wscript_build b/source3/passdb/wscript_build
Andreas Schneider 4717df1
index 03a0df4..a6620cd 100644
Andreas Schneider 4717df1
--- a/source3/passdb/wscript_build
Andreas Schneider 4717df1
+++ b/source3/passdb/wscript_build
Andreas Schneider 4717df1
@@ -13,13 +13,13 @@ bld.SAMBA3_MODULE('pdb_tdbsam',
Andreas Schneider 4717df1
                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('pdb_tdbsam'),
Andreas Schneider 4717df1
                  enabled=bld.SAMBA3_IS_ENABLED_MODULE('pdb_tdbsam'))
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
-bld.SAMBA3_MODULE('pdb_ldap',
Andreas Schneider 4717df1
+bld.SAMBA3_MODULE('pdb_ldapsam',
Andreas Schneider 4717df1
                  subsystem='pdb',
Andreas Schneider 4717df1
                  deps='smbldap smbldaphelper',
Andreas Schneider 4717df1
                  source=PDB_LDAP_SRC,
Andreas Schneider 4717df1
                  init_function='',
Andreas Schneider 4717df1
-                 internal_module=bld.SAMBA3_IS_STATIC_MODULE('pdb_ldap'),
Andreas Schneider 4717df1
-                 enabled=bld.SAMBA3_IS_ENABLED_MODULE('pdb_ldap') and bld.CONFIG_SET('HAVE_LDAP'))
Andreas Schneider 4717df1
+                 internal_module=bld.SAMBA3_IS_STATIC_MODULE('pdb_ldapsam'),
Andreas Schneider 4717df1
+                 enabled=bld.SAMBA3_IS_ENABLED_MODULE('pdb_ldapsam') and bld.CONFIG_SET('HAVE_LDAP'))
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
 bld.SAMBA3_MODULE('pdb_smbpasswd',
Andreas Schneider 4717df1
                  subsystem='pdb',
Andreas Schneider 4717df1
diff --git a/source3/wscript b/source3/wscript
Andreas Schneider 4717df1
index 097cd83..34fccb1 100644
Andreas Schneider 4717df1
--- a/source3/wscript
Andreas Schneider 4717df1
+++ b/source3/wscript
Andreas Schneider 4717df1
@@ -1734,7 +1734,7 @@ main() {
Andreas Schneider 4717df1
         default_shared_modules.extend(TO_LIST('vfs_aio_linux'))
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
     if conf.CONFIG_SET('HAVE_LDAP'):
Andreas Schneider 4717df1
-        default_static_modules.extend(TO_LIST('pdb_ldap idmap_ldap'))
Andreas Schneider 4717df1
+        default_static_modules.extend(TO_LIST('pdb_ldapsam idmap_ldap'))
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
     if conf.CONFIG_SET('DARWINOS'):
Andreas Schneider 4717df1
         default_static_modules.extend(TO_LIST('charset_macosxfs'))
Andreas Schneider 4717df1
-- 
Andreas Schneider 4717df1
1.8.1.2
Andreas Schneider 4717df1
Andreas Schneider 4717df1
From 8c7b0ab9b3ae07574c6b5c5ba5888c3f329c9e02 Mon Sep 17 00:00:00 2001
Andreas Schneider 4717df1
From: Alexander Bokovoy <ab@samba.org>
Andreas Schneider 4717df1
Date: Wed, 6 Feb 2013 10:43:16 +0200
Andreas Schneider 4717df1
Subject: [PATCH 2/3] source3/wscript: support 'pdb_ldap' module in configure
Andreas Schneider 4717df1
Andreas Schneider 4717df1
While PASSDB module ldapsam is called pdb_ldapsam internally,
Andreas Schneider 4717df1
support specifying 'pdb_ldap' during configure step.
Andreas Schneider 4717df1
Andreas Schneider 4717df1
This should make transition to pdb_ldapsam transparent to distributions.
Andreas Schneider 4717df1
Andreas Schneider 4717df1
Reviewed-by: Andreas Schneider <asn@samba.org>
Andreas Schneider 4717df1
---
Andreas Schneider 4717df1
 source3/wscript | 13 +++++++++++++
Andreas Schneider 4717df1
 1 file changed, 13 insertions(+)
Andreas Schneider 4717df1
Andreas Schneider 4717df1
diff --git a/source3/wscript b/source3/wscript
Andreas Schneider 4717df1
index 34fccb1..194d712 100644
Andreas Schneider 4717df1
--- a/source3/wscript
Andreas Schneider 4717df1
+++ b/source3/wscript
Andreas Schneider 4717df1
@@ -1745,6 +1745,19 @@ main() {
Andreas Schneider 4717df1
     explicit_shared_modules = TO_LIST(Options.options.shared_modules, delimiter=',')
Andreas Schneider 4717df1
     explicit_static_modules = TO_LIST(Options.options.static_modules, delimiter=',')
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
+    def replace_list_item(lst, item, value):
Andreas Schneider 4717df1
+        try:
Andreas Schneider 4717df1
+            idx = lst.index(item)
Andreas Schneider 4717df1
+            lst[idx] = value
Andreas Schneider 4717df1
+        except:
Andreas Schneider 4717df1
+            pass
Andreas Schneider 4717df1
+    # PDB module file name should have the same name as module registers itself
Andreas Schneider 4717df1
+    # In Autoconf build we export LDAP passdb module as ldapsam but WAF build
Andreas Schneider 4717df1
+    # was always exporting pdb_ldap. In order to support existing packages
Andreas Schneider 4717df1
+    # allow referring to pdb_ldapsam as pdb_ldap but use proper name internally.
Andreas Schneider 4717df1
+    replace_list_item(explicit_shared_modules, 'pdb_ldap', 'pdb_ldapsam')
Andreas Schneider 4717df1
+    replace_list_item(explicit_static_modules, 'pdb_ldap', 'pdb_ldapsam')
Andreas Schneider 4717df1
+
Andreas Schneider 4717df1
     final_static_modules = default_static_modules
Andreas Schneider 4717df1
     final_shared_modules = default_shared_modules
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
-- 
Andreas Schneider 4717df1
1.8.1.2
Andreas Schneider 4717df1
Andreas Schneider 4717df1
From 2b070b226926798fc544f6867721f57a5ec7075c Mon Sep 17 00:00:00 2001
Andreas Schneider 4717df1
From: Alexander Bokovoy <ab@samba.org>
Andreas Schneider 4717df1
Date: Wed, 6 Feb 2013 12:22:12 +0200
Andreas Schneider 4717df1
Subject: [PATCH 3/3] autoconf: rename pdb_ldap module to pdb_ldapsam
Andreas Schneider 4717df1
Andreas Schneider 4717df1
Reviewed-by: Andreas Schneider <asn@samba.org>
Andreas Schneider 4717df1
Andreas Schneider 4717df1
Autobuild-User(master): Alexander Bokovoy <ab@samba.org>
Andreas Schneider 4717df1
Autobuild-Date(master): Wed Feb  6 13:32:53 CET 2013 on sn-devel-104
Andreas Schneider 4717df1
---
Andreas Schneider 4717df1
 source3/configure.in | 9 +++++++--
Andreas Schneider 4717df1
 1 file changed, 7 insertions(+), 2 deletions(-)
Andreas Schneider 4717df1
Andreas Schneider 4717df1
diff --git a/source3/configure.in b/source3/configure.in
Andreas Schneider 4717df1
index d0c2a48..a4e0763 100644
Andreas Schneider 4717df1
--- a/source3/configure.in
Andreas Schneider 4717df1
+++ b/source3/configure.in
Andreas Schneider 4717df1
@@ -3276,7 +3276,7 @@ if test x"$with_ldap_support" != x"no"; then
Andreas Schneider 4717df1
   if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes"; then
Andreas Schneider 4717df1
     AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])
Andreas Schneider 4717df1
     CPPFLAGS="$CPPFLAGS -DLDAP_DEPRECATED"
Andreas Schneider 4717df1
-    default_static_modules="$default_static_modules pdb_ldap idmap_ldap";
Andreas Schneider 4717df1
+    default_static_modules="$default_static_modules pdb_ldapsam idmap_ldap";
Andreas Schneider 4717df1
     default_shared_modules="$default_shared_modules";
Andreas Schneider 4717df1
     SMBLDAP="lib/smbldap.o"
Andreas Schneider 4717df1
     with_ldap_support=yes
Andreas Schneider 4717df1
@@ -6353,13 +6353,18 @@ AC_ARG_WITH(shared-modules,
Andreas Schneider 4717df1
 	done
Andreas Schneider 4717df1
 fi ])
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
+# additionally, support pdb_ldap -> pdb_ldapsam replacement
Andreas Schneider 4717df1
+if test x"$MODULE_pdb_ldap" != x ; then
Andreas Schneider 4717df1
+	MODULE_pdb_ldapsam="$MODULE_pdb_ldap"
Andreas Schneider 4717df1
+fi
Andreas Schneider 4717df1
+
Andreas Schneider 4717df1
 if test x"$MODULE_DEFAULT_vfs_notify_fam" = xSTATIC -o \
Andreas Schneider 4717df1
 		x"$MODULE_vfs_notify_fam" = xSTATIC ; then
Andreas Schneider 4717df1
 	SMBD_FAM_LIBS="$SMB_FAM_LIBS"
Andreas Schneider 4717df1
 	AC_SUBST(SMBD_FAM_LIBS)
Andreas Schneider 4717df1
 fi
Andreas Schneider 4717df1
 
Andreas Schneider 4717df1
-SMB_MODULE(pdb_ldap, passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_ipa.o passdb/pdb_ldap_util.o,
Andreas Schneider 4717df1
+SMB_MODULE(pdb_ldapsam, passdb/pdb_ldap.o passdb/pdb_nds.o passdb/pdb_ipa.o passdb/pdb_ldap_util.o,
Andreas Schneider 4717df1
 		   "bin/ldapsam.$SHLIBEXT", PDB,
Andreas Schneider 4717df1
 		   [ PASSDB_LIBS="$PASSDB_LIBS $LDAP_LIBS" ] )
Andreas Schneider 4717df1
 SMB_MODULE(pdb_smbpasswd, passdb/pdb_smbpasswd.o, "bin/smbpasswd.$SHLIBEXT", PDB)
Andreas Schneider 4717df1
-- 
Andreas Schneider 4717df1
1.8.1.2
Andreas Schneider 4717df1