From 480fd4f9b558b668c77af2825963e5f9c616c165 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 1 Mar 2004 13:02:06 +0000 Subject: Add aliases to winbindd_getgroups(). su - WINDOWS\\vl now includes the locally defined aliases I'm member of. Next will be getent group. Volker (This used to be commit 52dae45684317ac8ac529017607bb5787dda7c50) --- source3/groupdb/mapping.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'source3/groupdb/mapping.c') diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index 5eaa4e1386..c153ff258d 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -542,19 +542,6 @@ static NTSTATUS add_aliasmem(const DOM_SID *alias, const DOM_SID *member) return (result == 0 ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED); } -static BOOL add_sid_to_array(DOM_SID sid, DOM_SID **sids, int *num) -{ - *sids = Realloc(*sids, ((*num)+1) * sizeof(DOM_SID)); - - if (*sids == NULL) - return False; - - sid_copy(&((*sids)[*num]), &sid); - *num += 1; - - return True; -} - static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, int *num) { GROUP_MAP map; @@ -599,7 +586,9 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, int *num) if (!string_to_sid(&sid, string_sid)) continue; - if (!add_sid_to_array(sid, sids, num)) + add_sid_to_array(sid, sids, num); + + if (sids == NULL) return NT_STATUS_NO_MEMORY; } @@ -713,8 +702,16 @@ static NTSTATUS alias_memberships(const DOM_SID *sid, DOM_SID **sids, int *num) return NT_STATUS_NO_MEMORY; for (i=0; i