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

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Alexander Bokovoy 2017-07-03 14:38:05 +03:00 committed by Martin Basti
parent 11d43a1603
commit 3ab6a68e91
2 changed files with 9 additions and 0 deletions

View File

@ -4532,8 +4532,12 @@ static NTSTATUS pdb_init_ipasam(struct pdb_methods **pdb_method,
uri, false, NULL, NULL, uri, false, NULL, NULL,
&ipasam_state->ldap_state); &ipasam_state->ldap_state);
if (NT_STATUS_IS_OK(status)) { 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 = bind_callback;
ipasam_state->ldap_state->bind_callback_data = ipasam_state; ipasam_state->ldap_state->bind_callback_data = ipasam_state;
#endif
} }
} }

View File

@ -111,6 +111,11 @@ AC_CHECK_LIB([smbldap],[smbldap_get_ldap],
[AC_MSG_WARN([libsmbldap is not opaque, not using smbldap_get_ldap])], [AC_MSG_WARN([libsmbldap is not opaque, not using smbldap_get_ldap])],
[$SAMBA40EXTRA_LIBPATH]) [$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 ---------------------------------------------------------------------------
dnl Check for libunistring dnl Check for libunistring
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------