summaryrefslogtreecommitdiff
path: root/source3/groupdb
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-03-27 16:33:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:20 -0500
commite84ead0cfdc5e45a577387cc54dceb4c3f32948a (patch)
tree98d8898697479b516a36e534d3b3c9e3ce8e76c7 /source3/groupdb
parent0aa89db9471330fd02db395c2eb387ac2dfef54f (diff)
downloadsamba-e84ead0cfdc5e45a577387cc54dceb4c3f32948a.tar.gz
samba-e84ead0cfdc5e45a577387cc54dceb4c3f32948a.tar.bz2
samba-e84ead0cfdc5e45a577387cc54dceb4c3f32948a.zip
r6080: Port some of the non-critical changes from HEAD to 3_0. The main one is the
change in pdb_enum_alias_memberships to match samr.idl a bit closer. Volker (This used to be commit 3a6786516957d9f67af6d53a3167c88aa272972f)
Diffstat (limited to 'source3/groupdb')
-rw-r--r--source3/groupdb/mapping.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 5613240a12..83ba575759 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -518,7 +518,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
if (!string_to_sid(&alias, string_sid))
continue;
- add_sid_to_array_unique(&alias, sids, num);
+ add_sid_to_array_unique(NULL, &alias, sids, num);
if (sids == NULL)
return NT_STATUS_NO_MEMORY;
@@ -665,7 +665,7 @@ static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data,
if (!string_to_sid(&member, member_string))
continue;
- add_sid_to_array(&member, closure->sids, closure->num);
+ add_sid_to_array(NULL, &member, closure->sids, closure->num);
}
return 0;
@@ -1348,11 +1348,42 @@ NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
}
NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
- const DOM_SID *members,
+ TALLOC_CTX *mem_ctx,
+ const DOM_SID *domain_sid,
+ const DOM_SID const *members,
int num_members,
- DOM_SID **aliases, int *num)
+ uint32 **alias_rids,
+ int *num_alias_rids)
{
- return alias_memberships(members, num_members, aliases, num);
+ DOM_SID *alias_sids;
+ int i, num_alias_sids;
+ NTSTATUS result;
+
+ alias_sids = NULL;
+ num_alias_sids = 0;
+
+ result = alias_memberships(members, num_members,
+ &alias_sids, &num_alias_sids);
+
+ if (!NT_STATUS_IS_OK(result))
+ return result;
+
+ *alias_rids = TALLOC_ARRAY(mem_ctx, uint32, num_alias_sids);
+ if ((alias_sids != 0) && (*alias_rids == NULL))
+ return NT_STATUS_NO_MEMORY;
+
+ *num_alias_rids = 0;
+
+ for (i=0; i<num_alias_sids; i++) {
+ if (!sid_peek_check_rid(domain_sid, &alias_sids[i],
+ &(*alias_rids)[*num_alias_rids]))
+ continue;
+ *num_alias_rids += 1;
+ }
+
+ SAFE_FREE(alias_sids);
+
+ return NT_STATUS_OK;
}
/**********************************************************************