Only do string comparisons on the group members if there is no
supplemental group list.
This commit is contained in:
13
match.c
13
match.c
@@ -539,15 +539,16 @@ 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.
|
||||||
|
* Otherwise, check the member list in struct group for the user name.
|
||||||
|
*/
|
||||||
|
if ((n = user_ngroups) > 0) {
|
||||||
while (n--)
|
while (n--)
|
||||||
if (grp->gr_gid == user_groups[n])
|
if (grp->gr_gid == user_groups[n])
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
} else {
|
||||||
/* check to see if user is explicitly listed in the group */
|
for (cur = grp->gr_mem; *cur; cur++)
|
||||||
/* XXX - skip if group vector is set? */
|
|
||||||
for (cur = grp->gr_mem; *cur; cur++) {
|
|
||||||
if (strcmp(*cur, user) == 0)
|
if (strcmp(*cur, user) == 0)
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user