2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Use supplementary group vector in struct sudo_user.

This commit is contained in:
Todd C. Miller
2004-11-16 23:55:26 +00:00
parent 596d1ef5a4
commit fc85c6f02d

21
ldap.c
View File

@@ -424,8 +424,6 @@ char *
sudo_ldap_build_pass1()
{
struct group *grp;
gid_t *grplist=NULL;
int ngrps;
int i;
char *b=NULL;
@@ -447,20 +445,15 @@ sudo_ldap_build_pass1()
ncat(&b,&sz,")");
}
/* handle arbitrary number of groups */
if (0<(ngrps=getgroups(0,NULL))){
grplist=calloc(ngrps,sizeof(gid_t));
if (grplist!=NULL && (0<getgroups(ngrps,grplist)))
for(i=0;i<ngrps;i++){
if((grp=sudo_getgrgid(grplist[i]))!=NULL){
ncat(&b,&sz,"(sudoUser=%");
ncat(&b,&sz,grp->gr_name);
ncat(&b,&sz,")");
}
}
/* Append supplementary groups */
for(i=0;i<user_ngroups;i++){
if((grp=sudo_getgrgid(user_groups[i]))!=NULL){
ncat(&b,&sz,"(sudoUser=%");
ncat(&b,&sz,grp->gr_name);
ncat(&b,&sz,")");
}
}
/* Add ALL to list */
ncat(&b,&sz,"(sudoUser=ALL)");