diff options
author | Christof Schmitt <christof.schmitt@us.ibm.com> | 2013-02-21 12:30:48 -0700 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-03-09 06:30:22 +0100 |
commit | 86d09ce779fdc9d6ebbbe44b25656808ab37ee14 (patch) | |
tree | 5a967ad323207002cbe61d88395b53e8c4b03306 /source3/winbindd/idmap_ldap.c | |
parent | 666a5630ef3b03640089a0b6e81bf578b91b88ab (diff) | |
download | samba-86d09ce779fdc9d6ebbbe44b25656808ab37ee14.tar.gz |
s3-winbindd: Move common code for LDAP id mapping to idmap_utils
idmap_ad and idmap_ldap use the same helper functions and the same
maximum query size. Move the code to idmap_utils so that it can be
shared by every module issuing LDAP queries.
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/winbindd/idmap_ldap.c')
-rw-r--r-- | source3/winbindd/idmap_ldap.c | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/source3/winbindd/idmap_ldap.c b/source3/winbindd/idmap_ldap.c index 0c58bf4236c..03872e7ab1d 100644 --- a/source3/winbindd/idmap_ldap.c +++ b/source3/winbindd/idmap_ldap.c @@ -663,34 +663,10 @@ static NTSTATUS idmap_ldap_new_mapping(struct idmap_domain *dom, struct id_map * return ret; } - -/* max number of ids requested per batch query */ -#define IDMAP_LDAP_MAX_IDS 30 - /********************************** lookup a set of unix ids. **********************************/ -/* this function searches up to IDMAP_LDAP_MAX_IDS entries - * in maps for a match */ -static struct id_map *find_map_by_id(struct id_map **maps, - enum id_type type, - uint32_t id) -{ - int i; - - for (i = 0; i < IDMAP_LDAP_MAX_IDS; i++) { - if (maps[i] == NULL) { /* end of the run */ - return NULL; - } - if ((maps[i]->xid.type == type) && (maps[i]->xid.id == id)) { - return maps[i]; - } - } - - return NULL; -} - static NTSTATUS idmap_ldap_unixids_to_sids(struct idmap_domain *dom, struct id_map **ids) { @@ -846,7 +822,7 @@ again: } TALLOC_FREE(tmp); - map = find_map_by_id(&ids[bidx], type, id); + map = idmap_find_map_by_id(&ids[bidx], type, id); if (!map) { DEBUG(2, ("WARNING: couldn't match sid (%s) " "with requested ids\n", sidstr)); @@ -903,24 +879,6 @@ done: lookup a set of sids. **********************************/ -/* this function searches up to IDMAP_LDAP_MAX_IDS entries - * in maps for a match */ -static struct id_map *find_map_by_sid(struct id_map **maps, struct dom_sid *sid) -{ - int i; - - for (i = 0; i < IDMAP_LDAP_MAX_IDS; i++) { - if (maps[i] == NULL) { /* end of the run */ - return NULL; - } - if (dom_sid_equal(maps[i]->sid, sid)) { - return maps[i]; - } - } - - return NULL; -} - static NTSTATUS idmap_ldap_sids_to_unixids(struct idmap_domain *dom, struct id_map **ids) { @@ -1053,7 +1011,7 @@ again: continue; } - map = find_map_by_sid(&ids[bidx], &sid); + map = idmap_find_map_by_sid(&ids[bidx], &sid); if (!map) { DEBUG(2, ("WARNING: couldn't find entry sid (%s) " "in ids", sidstr)); |