diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-10-08 13:00:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:52:55 -0500 |
commit | 3d502114809854a49fab0ff6c14cb6a51a07ab85 (patch) | |
tree | 24f093e00381d5f948e3c58d6c3326295c9badc5 /source3/groupdb | |
parent | d15e6af706fe7187972ce6f65a3d53a99c67fab2 (diff) | |
download | samba-3d502114809854a49fab0ff6c14cb6a51a07ab85.tar.gz samba-3d502114809854a49fab0ff6c14cb6a51a07ab85.tar.bz2 samba-3d502114809854a49fab0ff6c14cb6a51a07ab85.zip |
r2865: Add static and remove unused functions that only cload the blame-game
in finding out who is causing the massive performance problems with
large LDAP directories.
Andrew Bartlett
(This used to be commit f16ed2616a67c412bc9b78354a5faf673e64cf42)
Diffstat (limited to 'source3/groupdb')
-rw-r--r-- | source3/groupdb/mapping.c | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index 6725165c3c..d189f447d0 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -957,128 +957,6 @@ BOOL get_group_from_gid(gid_t gid, GROUP_MAP *map) } - - -/**************************************************************************** - Get the member users of a group and - all the users who have that group as primary. - - give back an array of SIDS - return the grand number of users - - - TODO: sort the list and remove duplicate. JFM. - -****************************************************************************/ - -BOOL get_sid_list_of_group(gid_t gid, DOM_SID **sids, int *num_sids) -{ - struct group *grp; - int i=0; - char *gr; - DOM_SID *s; - - struct sys_pwent *userlist; - struct sys_pwent *user; - - if(!init_group_mapping()) { - DEBUG(0,("failed to initialize group mapping\n")); - return(False); - } - - *num_sids = 0; - *sids=NULL; - - if ( (grp=getgrgid(gid)) == NULL) - return False; - - gr = grp->gr_mem[0]; - DEBUG(10, ("getting members\n")); - - while (gr && (*gr != (char)'\0')) { - SAM_ACCOUNT *group_member_acct = NULL; - BOOL found_user; - s = Realloc((*sids), sizeof(**sids)*(*num_sids+1)); - if (!s) { - DEBUG(0,("get_uid_list_of_group: unable to enlarge SID list!\n")); - return False; - } - else (*sids) = s; - - if (!NT_STATUS_IS_OK(pdb_init_sam(&group_member_acct))) { - continue; - } - - become_root(); - found_user = pdb_getsampwnam(group_member_acct, gr); - unbecome_root(); - - if (found_user) { - sid_copy(&(*sids)[*num_sids], pdb_get_user_sid(group_member_acct)); - (*num_sids)++; - } - - pdb_free_sam(&group_member_acct); - - gr = grp->gr_mem[++i]; - } - DEBUG(10, ("got [%d] members\n", *num_sids)); - - winbind_off(); - - user = userlist = getpwent_list(); - - while (user != NULL) { - - SAM_ACCOUNT *group_member_acct = NULL; - BOOL found_user; - - if (user->pw_gid != gid) { - user = user->next; - continue; - } - - s = Realloc((*sids), sizeof(**sids)*(*num_sids+1)); - if (!s) { - DEBUG(0,("get_sid_list_of_group: unable to enlarge " - "SID list!\n")); - pwent_free(userlist); - winbind_on(); - return False; - } - else (*sids) = s; - - if (!NT_STATUS_IS_OK(pdb_init_sam(&group_member_acct))) { - continue; - } - - become_root(); - found_user = pdb_getsampwnam(group_member_acct, user->pw_name); - unbecome_root(); - - if (found_user) { - sid_copy(&(*sids)[*num_sids], - pdb_get_user_sid(group_member_acct)); - (*num_sids)++; - } else { - DEBUG(4,("get_sid_list_of_group: User %s [uid == %lu] " - "has no samba account\n", - user->pw_name, (unsigned long)user->pw_uid)); - if (algorithmic_uid_to_sid(&(*sids)[*num_sids], - user->pw_uid)) - (*num_sids)++; - } - pdb_free_sam(&group_member_acct); - - user = user->next; - } - pwent_free(userlist); - DEBUG(10, ("got primary groups, members: [%d]\n", *num_sids)); - - winbind_on(); - return True; -} - /**************************************************************************** Create a UNIX group on demand. ****************************************************************************/ |