diff options
author | Volker Lendecke <vlendec@samba.org> | 2004-03-14 10:36:07 +0000 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2004-03-14 10:36:07 +0000 |
commit | 916d7852a57f9ef2f3c3b7e9a3dee0abce180737 (patch) | |
tree | 81fb020dfe28a82502e86f3a60d4ec84319a60d6 | |
parent | 6cd06f816d8b5c77f7691ecae4aa2ea84b305cc0 (diff) | |
download | samba-916d7852a57f9ef2f3c3b7e9a3dee0abce180737.tar.gz samba-916d7852a57f9ef2f3c3b7e9a3dee0abce180737.tar.bz2 samba-916d7852a57f9ef2f3c3b7e9a3dee0abce180737.zip |
Clean up a bit :-)
Volker
(This used to be commit 66c4a6dee88274c2e1493224b0ba694418b32796)
-rw-r--r-- | source3/groupdb/mapping.c | 13 | ||||
-rw-r--r-- | source3/passdb/util_sam_sid.c | 57 |
2 files changed, 13 insertions, 57 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index cbf022f377..319d39c99f 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -531,6 +531,19 @@ static NTSTATUS add_aliasmem(const DOM_SID *alias, const DOM_SID *member) return (result == 0 ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED); } +static void add_sid_to_array(const DOM_SID *sid, DOM_SID **sids, int *num) +{ + *sids = Realloc(*sids, ((*num)+1) * sizeof(DOM_SID)); + + if (*sids == NULL) + return; + + sid_copy(&((*sids)[*num]), sid); + *num += 1; + + return; +} + static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, int *num) { GROUP_MAP map; diff --git a/source3/passdb/util_sam_sid.c b/source3/passdb/util_sam_sid.c index 1d1e74cd6f..f6cc2491a8 100644 --- a/source3/passdb/util_sam_sid.c +++ b/source3/passdb/util_sam_sid.c @@ -305,60 +305,3 @@ BOOL map_name_to_wellknown_sid(DOM_SID *sid, enum SID_NAME_USE *use, const char return False; } - -void add_sid_to_array(const DOM_SID *sid, DOM_SID **sids, int *num) -{ - *sids = Realloc(*sids, ((*num)+1) * sizeof(DOM_SID)); - - if (*sids == NULL) - return; - - sid_copy(&((*sids)[*num]), sid); - *num += 1; - - return; -} - -void add_gid_to_array_unique(gid_t gid, gid_t **gids, int *num) -{ - int i; - - if ((*num) >= groups_max()) - return; - - for (i=0; i<*num; i++) { - if ((*gids)[i] == gid) - return; - } - - *gids = Realloc(*gids, (*num+1) * sizeof(gid_t)); - - if (*gids == NULL) - return; - - (*gids)[*num] = gid; - *num += 1; -} - -/************************************************************************** - Augment a gid list with gids from alias memberships -***************************************************************************/ - -void add_foreign_gids_from_sid(const DOM_SID *sid, gid_t **gids, int *num) -{ - DOM_SID *aliases; - int j, num_aliases; - - if (!pdb_enum_alias_memberships(sid, &aliases, &num_aliases)) - return; - - for (j=0; j<num_aliases; j++) { - gid_t gid; - - if (!NT_STATUS_IS_OK(sid_to_gid(&aliases[j], &gid))) - continue; - - add_gid_to_array_unique(gid, gids, num); - } - SAFE_FREE(aliases); -} |