ipa/0005-ipa-sam-use-smbldap_set_bind_callback-for-Samba-4.7-.patch
2017-07-10 09:55:28 +03:00

55 lines
2.0 KiB
Diff

From dc7dac0196d684b05cef047670ce95278036c5fb Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy@redhat.com>
Date: Mon, 3 Jul 2017 14:38:05 +0300
Subject: [PATCH 7/7] ipa-sam: use smbldap_set_bind_callback for Samba 4.7 or
later
Samba 4.7 tightens up smbldap API by making 'struct smbldap_state' an
opaque. This means ipa-sam module cannot anymore directly set its
LDAP bind callback.
Use new smbldap API to set the LDAP bind callback.
Fixes https://pagure.io/freeipa/issue/6877
---
daemons/ipa-sam/ipa_sam.c | 4 ++++
server.m4 | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c
index fe9913d61..0cd48d845 100644
--- a/daemons/ipa-sam/ipa_sam.c
+++ b/daemons/ipa-sam/ipa_sam.c
@@ -4532,8 +4532,12 @@ static NTSTATUS pdb_init_ipasam(struct pdb_methods **pdb_method,
uri, false, NULL, NULL,
&ipasam_state->ldap_state);
if (NT_STATUS_IS_OK(status)) {
+#ifdef HAVE_SMBLDAP_SET_BIND_CALLBACK
+ smbldap_set_bind_callback(ipasam_state->ldap_state, bind_callback, ipasam_state);
+#else
ipasam_state->ldap_state->bind_callback = bind_callback;
ipasam_state->ldap_state->bind_callback_data = ipasam_state;
+#endif
}
}
diff --git a/server.m4 b/server.m4
index 365abb60e..a9670c873 100644
--- a/server.m4
+++ b/server.m4
@@ -111,6 +111,11 @@ AC_CHECK_LIB([smbldap],[smbldap_get_ldap],
[AC_MSG_WARN([libsmbldap is not opaque, not using smbldap_get_ldap])],
[$SAMBA40EXTRA_LIBPATH])
+AC_CHECK_LIB([smbldap],[smbldap_set_bind_callback],
+ [AC_DEFINE([HAVE_SMBLDAP_SET_BIND_CALLBACK], [1], [struct smbldap_state is opaque])],
+ [AC_MSG_WARN([libsmbldap is not opaque, not using smbldap_set_bind_callback])],
+ [$SAMBA40EXTRA_LIBPATH])
+
dnl ---------------------------------------------------------------------------
dnl Check for libunistring
dnl ---------------------------------------------------------------------------
--
2.13.0