summaryrefslogtreecommitdiff
path: root/source3/winbindd/idmap_ldap.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-12-08 00:24:01 +0100
committerMichael Adam <obnox@samba.org>2011-01-02 12:51:54 +0100
commit5908bd62b557723f36d8055506d4602cfc567684 (patch)
tree13fc0183182dba08315380ffd0969ea3795faac5 /source3/winbindd/idmap_ldap.c
parent510bf2d59175cb4aabf26c0dc1afcb6873955cb4 (diff)
downloadsamba-5908bd62b557723f36d8055506d4602cfc567684.tar.gz
samba-5908bd62b557723f36d8055506d4602cfc567684.tar.bz2
samba-5908bd62b557723f36d8055506d4602cfc567684.zip
s3:idmap_ldap: remove use of alloc context from idmap_ldap_allocate_id().
Diffstat (limited to 'source3/winbindd/idmap_ldap.c')
-rw-r--r--source3/winbindd/idmap_ldap.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/source3/winbindd/idmap_ldap.c b/source3/winbindd/idmap_ldap.c
index a957102545..a8d27b3a8c 100644
--- a/source3/winbindd/idmap_ldap.c
+++ b/source3/winbindd/idmap_ldap.c
@@ -268,11 +268,7 @@ static NTSTATUS idmap_ldap_allocate_id(struct idmap_domain *dom,
ctx = talloc_get_type(dom->private_data, struct idmap_ldap_context);
- if (!ctx->alloc) {
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- mem_ctx = talloc_new(ctx->alloc);
+ mem_ctx = talloc_new(ctx);
if (!mem_ctx) {
DEBUG(0, ("Out of memory!\n"));
return NT_STATUS_NO_MEMORY;
@@ -304,10 +300,10 @@ static NTSTATUS idmap_ldap_allocate_id(struct idmap_domain *dom,
DEBUG(10, ("Search of the id pool (filter: %s)\n", filter));
- rc = smbldap_search(ctx->alloc->smbldap_state,
- ctx->alloc->suffix,
- LDAP_SCOPE_SUBTREE, filter,
- attr_list, 0, &result);
+ rc = smbldap_search(ctx->smbldap_state,
+ ctx->suffix,
+ LDAP_SCOPE_SUBTREE, filter,
+ attr_list, 0, &result);
if (rc != LDAP_SUCCESS) {
DEBUG(0,("%s object not found\n", LDAP_OBJ_IDPOOL));
@@ -316,25 +312,23 @@ static NTSTATUS idmap_ldap_allocate_id(struct idmap_domain *dom,
talloc_autofree_ldapmsg(mem_ctx, result);
- count = ldap_count_entries(ctx->alloc->smbldap_state->ldap_struct,
- result);
+ count = ldap_count_entries(ctx->smbldap_state->ldap_struct, result);
if (count != 1) {
DEBUG(0,("Single %s object not found\n", LDAP_OBJ_IDPOOL));
goto done;
}
- entry = ldap_first_entry(ctx->alloc->smbldap_state->ldap_struct,
- result);
+ entry = ldap_first_entry(ctx->smbldap_state->ldap_struct, result);
dn = smbldap_talloc_dn(mem_ctx,
- ctx->alloc->smbldap_state->ldap_struct,
+ ctx->smbldap_state->ldap_struct,
entry);
if ( ! dn) {
goto done;
}
id_str = smbldap_talloc_single_attribute(
- ctx->alloc->smbldap_state->ldap_struct,
+ ctx->smbldap_state->ldap_struct,
entry, type, mem_ctx);
if (id_str == NULL) {
DEBUG(0,("%s attribute not found\n", type));
@@ -386,7 +380,7 @@ static NTSTATUS idmap_ldap_allocate_id(struct idmap_domain *dom,
DEBUG(10, ("Try to atomically increment the id (%s -> %s)\n",
id_str, new_id_str));
- rc = smbldap_modify(ctx->alloc->smbldap_state, dn, mods);
+ rc = smbldap_modify(ctx->smbldap_state, dn, mods);
ldap_mods_free(mods, True);