This code in autoconf:
{ gid_t groups[3*2];unsigned i;
for(i=getgroups(3,groups);--i<3&&groups[i]==getgid(););
if(i<3)
{ setegid(groups[i]);
if(!setrgid(groups[i])&&getgid()!=groups[i])
puts("#define setrgid_BRAIN_DAMAGE");
}
always fails for me because I'm in more than 3 groups.
Also, I think the <3 test is buggy, I think it should be >=0 in both
places. The tests as written are always true because the return from
getgroups() is at most 3 and i is decremented before testing, plus
there's nothing there to prevent i from dropping below 0 and the loop
never stopping.
Also, since the as-root case for this test is more useful (it's a little
safer if you have TOGGLE_SGID_OKAY set) perhaps INSTALL should mention
that there's an advantage to running autoconf as root.
--
Roderick Schertler
roderick(_at_)argon(_dot_)org