diff options
author | Volker Lendecke <vlendec@samba.org> | 2004-03-01 13:02:06 +0000 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2004-03-01 13:02:06 +0000 |
commit | 480fd4f9b558b668c77af2825963e5f9c616c165 (patch) | |
tree | 916389534ec453490c3956a733a7ffd42d261092 /source3/groupdb | |
parent | 0af6ee14c1ab480e5a3d2e82f803253581a2896f (diff) | |
download | samba-480fd4f9b558b668c77af2825963e5f9c616c165.tar.gz samba-480fd4f9b558b668c77af2825963e5f9c616c165.tar.bz2 samba-480fd4f9b558b668c77af2825963e5f9c616c165.zip |
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)
Diffstat (limited to 'source3/groupdb')
-rw-r--r-- | source3/groupdb/mapping.c | 39 |
1 files changed, 23 insertions, 16 deletions
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<num_maps; i++) { - if (is_foreign_alias_member(sid, &maps[i].sid)) + + if (is_foreign_alias_member(sid, &maps[i].sid)) { + add_sid_to_array(maps[i].sid, sids, num); + + if (sids == NULL) { + SAFE_FREE(maps); + return NT_STATUS_NO_MEMORY; + } + } } SAFE_FREE(maps); @@ -722,8 +719,15 @@ static NTSTATUS alias_memberships(const DOM_SID *sid, DOM_SID **sids, int *num) return NT_STATUS_NO_MEMORY; for (i=0; i<num_maps; i++) { - if (is_foreign_alias_member(sid, &maps[i].sid)) + if (is_foreign_alias_member(sid, &maps[i].sid)) { + add_sid_to_array(maps[i].sid, sids, num); + + if (sids == NULL) { + SAFE_FREE(maps); + return NT_STATUS_NO_MEMORY; + } + } } SAFE_FREE(maps); @@ -1054,6 +1058,9 @@ BOOL get_sid_list_of_group(gid_t gid, DOM_SID **sids, int *num_sids) for (i=0; i<num_members; i++) { add_sid_to_array(members[i], sids, num_sids); + + if (sids == NULL) + return False; } } |