Only do string comparisons on the group members if there is no

supplemental group list.
This commit is contained in:
Todd C. Miller
2004-11-16 23:40:58 +00:00
parent cfbf7768ff
commit 596d1ef5a4

23
match.c
View File

@@ -539,17 +539,18 @@ usergr_matches(group, user, pw)
if (grp->gr_gid == pw_gid) if (grp->gr_gid == pw_gid)
return(TRUE); return(TRUE);
/* check the user's group vector */ /*
n = user_ngroups; * If the user has a supplementary group vector, check it.
while (n--) * Otherwise, check the member list in struct group for the user name.
if (grp->gr_gid == user_groups[n]) */
return(TRUE); if ((n = user_ngroups) > 0) {
while (n--)
/* check to see if user is explicitly listed in the group */ if (grp->gr_gid == user_groups[n])
/* XXX - skip if group vector is set? */ return(TRUE);
for (cur = grp->gr_mem; *cur; cur++) { } else {
if (strcmp(*cur, user) == 0) for (cur = grp->gr_mem; *cur; cur++)
return(TRUE); if (strcmp(*cur, user) == 0)
return(TRUE);
} }
return(FALSE); return(FALSE);