diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-03-27 16:33:04 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:56:20 -0500 |
commit | 3a6786516957d9f67af6d53a3167c88aa272972f (patch) | |
tree | a9323480d1f7297fc530e4cf04e7e3cd17f2b516 /source/groupdb/mapping.c | |
parent | 0e29dc8aa384dfa6d2495beb8a9ffb5371e60a13 (diff) | |
download | samba-3a6786516957d9f67af6d53a3167c88aa272972f.tar.gz samba-3a6786516957d9f67af6d53a3167c88aa272972f.tar.xz samba-3a6786516957d9f67af6d53a3167c88aa272972f.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
Diffstat (limited to 'source/groupdb/mapping.c')
-rw-r--r-- | source/groupdb/mapping.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/source/groupdb/mapping.c b/source/groupdb/mapping.c index 5613240a121..83ba575759e 100644 --- a/source/groupdb/mapping.c +++ b/source/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; } /********************************************************************** |