1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

smbldap: expose bind callback via API and increase smbldap ABI version

Until we fully migrate to use gensec in smbldap, we need to continue
exposing bind callback to allow FreeIPA to integrate with smbldap.

Since smbldap API is now lacking direct access to 'struct
smbldap_state' and new API functions were added to give access to
individual members of this structure, it makes sense to increase ABI
version too.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jul  4 11:14:49 CEST 2017 on sn-devel-144
This commit is contained in:
Alexander Bokovoy 2017-07-03 11:58:50 +03:00 committed by Andrew Bartlett
parent fca8536a82
commit 332b179143
4 changed files with 50 additions and 7 deletions

View File

@ -34,6 +34,9 @@
*/
struct smbldap_state;
typedef int (*smbldap_bind_callback_fn)(LDAP *ldap_struct,
struct smbldap_state *ldap_state,
void *data);
/* The following definitions come from lib/smbldap.c */
@ -50,6 +53,10 @@ bool smbldap_get_paged_results(struct smbldap_state *state);
void smbldap_set_paged_results(struct smbldap_state *state,
bool paged_results);
void smbldap_set_bind_callback(struct smbldap_state *state,
smbldap_bind_callback_fn callback,
void *callback_data);
void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *newblob);
void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,

View File

@ -0,0 +1,32 @@
smbldap_add: int (struct smbldap_state *, const char *, LDAPMod **)
smbldap_delete: int (struct smbldap_state *, const char *)
smbldap_extended_operation: int (struct smbldap_state *, const char *, struct berval *, LDAPControl **, LDAPControl **, char **, struct berval **)
smbldap_free_struct: void (struct smbldap_state **)
smbldap_get_ldap: LDAP *(struct smbldap_state *)
smbldap_get_paged_results: bool (struct smbldap_state *)
smbldap_get_single_attribute: bool (LDAP *, LDAPMessage *, const char *, char *, int)
smbldap_has_control: bool (LDAP *, const char *)
smbldap_has_extension: bool (LDAP *, const char *)
smbldap_has_naming_context: bool (LDAP *, const char *)
smbldap_init: NTSTATUS (TALLOC_CTX *, struct tevent_context *, const char *, bool, const char *, const char *, struct smbldap_state **)
smbldap_make_mod: void (LDAP *, LDAPMessage *, LDAPMod ***, const char *, const char *)
smbldap_make_mod_blob: void (LDAP *, LDAPMessage *, LDAPMod ***, const char *, const DATA_BLOB *)
smbldap_modify: int (struct smbldap_state *, const char *, LDAPMod **)
smbldap_pull_sid: bool (LDAP *, LDAPMessage *, const char *, struct dom_sid *)
smbldap_search: int (struct smbldap_state *, const char *, int, const char *, const char **, int, LDAPMessage **)
smbldap_search_paged: int (struct smbldap_state *, const char *, int, const char *, const char **, int, int, LDAPMessage **, void **)
smbldap_search_suffix: int (struct smbldap_state *, const char *, const char **, LDAPMessage **)
smbldap_set_bind_callback: void (struct smbldap_state *, smbldap_bind_callback_fn, void *)
smbldap_set_creds: bool (struct smbldap_state *, bool, const char *, const char *)
smbldap_set_mod: void (LDAPMod ***, int, const char *, const char *)
smbldap_set_mod_blob: void (LDAPMod ***, int, const char *, const DATA_BLOB *)
smbldap_set_paged_results: void (struct smbldap_state *, bool)
smbldap_setup_full_conn: int (LDAP **, const char *)
smbldap_start_tls: int (LDAP *, int)
smbldap_talloc_autofree_ldapmod: void (TALLOC_CTX *, LDAPMod **)
smbldap_talloc_autofree_ldapmsg: void (TALLOC_CTX *, LDAPMessage *)
smbldap_talloc_dn: char *(TALLOC_CTX *, LDAP *, LDAPMessage *)
smbldap_talloc_first_attribute: char *(LDAP *, LDAPMessage *, const char *, TALLOC_CTX *)
smbldap_talloc_single_attribute: char *(LDAP *, LDAPMessage *, const char *, TALLOC_CTX *)
smbldap_talloc_single_blob: bool (TALLOC_CTX *, LDAP *, LDAPMessage *, const char *, DATA_BLOB *)
smbldap_talloc_smallest_attribute: char *(LDAP *, LDAPMessage *, const char *, TALLOC_CTX *)

View File

@ -46,8 +46,7 @@ struct smbldap_state {
bool anonymous;
char *bind_dn;
char *bind_secret;
int (*bind_callback)(LDAP *ldap_struct,
struct smbldap_state *ldap_state, void *data);
smbldap_bind_callback_fn bind_callback;
void *bind_callback_data;
bool paged_results;
@ -77,6 +76,13 @@ void smbldap_set_paged_results(struct smbldap_state *state,
state->paged_results = paged_results;
}
void smbldap_set_bind_callback(struct smbldap_state *state,
smbldap_bind_callback_fn callback,
void *callback_data)
{
state->bind_callback = callback;
state->bind_callback_data = callback_data;
}
/*******************************************************************
Search an attribute and return the first value found.
******************************************************************/
@ -1726,8 +1732,7 @@ void smbldap_free_struct(struct smbldap_state **ldap_state)
SAFE_FREE((*ldap_state)->bind_dn);
SAFE_FREE((*ldap_state)->bind_secret);
(*ldap_state)->bind_callback = NULL;
(*ldap_state)->bind_callback_data = NULL;
smbldap_set_bind_callback(*ldap_state, NULL, NULL);
TALLOC_FREE(*ldap_state);
@ -1907,8 +1912,7 @@ bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *
/* free any previously set credential */
SAFE_FREE(ldap_state->bind_dn);
ldap_state->bind_callback = NULL;
ldap_state->bind_callback_data = NULL;
smbldap_set_bind_callback(ldap_state, NULL, NULL);
if (ldap_state->bind_secret) {
/* make sure secrets are zeroed out of memory */

View File

@ -523,7 +523,7 @@ bld.SAMBA3_LIBRARY('smbldap',
abi_directory='lib/ABI',
abi_match='smbldap_*',
pc_files=[],
vnum='1',
vnum='2',
public_headers='include/smbldap.h include/smb_ldap.h')
bld.SAMBA3_LIBRARY('ads',