summaryrefslogtreecommitdiff
path: root/source3/groupdb/mapping.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/groupdb/mapping.c')
-rw-r--r--source3/groupdb/mapping.c122
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.
****************************************************************************/