Protect against duplicate gids in group list (as could be the
result of being a member of some group in both /etc/group and YP).
This commit is contained in:
parent
9c3d4683ed
commit
ecb476bce3
@ -70,8 +70,10 @@ getgrouplist(uname, agroup, groups, grpcnt)
|
||||
*/
|
||||
setgrent();
|
||||
while (grp = getgrent()) {
|
||||
if (grp->gr_gid == agroup)
|
||||
continue;
|
||||
for (i = 1; i < ngroups; i++) {
|
||||
if (grp->gr_gid == groups[i])
|
||||
goto skip;
|
||||
}
|
||||
if (ngroups >= maxgroups) {
|
||||
ret = -1;
|
||||
break;
|
||||
@ -82,6 +84,7 @@ getgrouplist(uname, agroup, groups, grpcnt)
|
||||
break;
|
||||
}
|
||||
}
|
||||
skip:
|
||||
}
|
||||
endgrent();
|
||||
*grpcnt = ngroups;
|
||||
|
Loading…
Reference in New Issue
Block a user