summaryrefslogtreecommitdiff
path: root/source3/groupdb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/groupdb')
-rw-r--r--source3/groupdb/mapping.c7
-rw-r--r--source3/groupdb/mapping.h3
-rw-r--r--source3/groupdb/mapping_ldb.c5
-rw-r--r--source3/groupdb/mapping_tdb.c7
4 files changed, 14 insertions, 8 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 4f05d732f1..12d0bd365c 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -606,14 +606,15 @@ NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
}
NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
- const DOM_SID *alias, DOM_SID **pp_members,
- size_t *p_num_members)
+ const DOM_SID *alias, TALLOC_CTX *mem_ctx,
+ DOM_SID **pp_members, size_t *p_num_members)
{
if (!init_group_mapping()) {
DEBUG(0,("failed to initialize group mapping\n"));
return NT_STATUS_UNSUCCESSFUL;
}
- return backend->enum_aliasmem(alias, pp_members, p_num_members);
+ return backend->enum_aliasmem(alias, mem_ctx, pp_members,
+ p_num_members);
}
NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
diff --git a/source3/groupdb/mapping.h b/source3/groupdb/mapping.h
index c37ae84b87..519b0ae08a 100644
--- a/source3/groupdb/mapping.h
+++ b/source3/groupdb/mapping.h
@@ -29,5 +29,6 @@ struct mapping_backend {
DOM_SID **sids, size_t *num);
NTSTATUS (*add_aliasmem)(const DOM_SID *alias, const DOM_SID *member);
NTSTATUS (*del_aliasmem)(const DOM_SID *alias, const DOM_SID *member);
- NTSTATUS (*enum_aliasmem)(const DOM_SID *alias, DOM_SID **sids, size_t *num);
+ NTSTATUS (*enum_aliasmem)(const DOM_SID *alias, TALLOC_CTX *mem_ctx,
+ DOM_SID **sids, size_t *num);
};
diff --git a/source3/groupdb/mapping_ldb.c b/source3/groupdb/mapping_ldb.c
index cc06282aee..89966e1986 100644
--- a/source3/groupdb/mapping_ldb.c
+++ b/source3/groupdb/mapping_ldb.c
@@ -488,7 +488,8 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member)
/*
enumerate sids that have the given alias set in member
*/
-static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num)
+static NTSTATUS enum_aliasmem(const DOM_SID *alias, TALLOC_CTX *mem_ctx,
+ DOM_SID **sids, size_t *num)
{
const char *attrs[] = {
"member",
@@ -529,7 +530,7 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num)
for (i=0;i<el->num_values;i++) {
DOM_SID sid;
string_to_sid(&sid, (const char *)el->values[i].data);
- status = add_sid_to_array_unique(NULL, &sid, sids, num);
+ status = add_sid_to_array_unique(mem_ctx, &sid, sids, num);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index 29927eb592..8498f0c821 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -535,6 +535,7 @@ static NTSTATUS add_aliasmem(const DOM_SID *alias, const DOM_SID *member)
}
struct aliasmem_state {
+ TALLOC_CTX *mem_ctx;
const DOM_SID *alias;
DOM_SID **sids;
size_t *num;
@@ -580,7 +581,7 @@ static int collect_aliasmem(struct db_record *rec, void *priv)
if (!string_to_sid(&member, member_string))
continue;
- if (!NT_STATUS_IS_OK(add_sid_to_array(NULL, &member,
+ if (!NT_STATUS_IS_OK(add_sid_to_array(state->mem_ctx, &member,
state->sids,
state->num)))
{
@@ -593,7 +594,8 @@ static int collect_aliasmem(struct db_record *rec, void *priv)
return 0;
}
-static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num)
+static NTSTATUS enum_aliasmem(const DOM_SID *alias, TALLOC_CTX *mem_ctx,
+ DOM_SID **sids, size_t *num)
{
GROUP_MAP map;
struct aliasmem_state state;
@@ -611,6 +613,7 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num)
state.alias = alias;
state.sids = sids;
state.num = num;
+ state.mem_ctx = mem_ctx;
db->traverse_read(db, collect_aliasmem, &state);
return NT_STATUS_OK;