Subject: Re: bin/792: su(1) ignores primary group, it and id(1) disagree with kernel on group membership
To: Jason Downs <downsj@PEAK.ORG>
From: Daniel Carosone <danielce@ee.mu.OZ.AU>
List: netbsd-users
Date: 02/11/1995 12:35:35
Jason Downs writes:
 > In message <199502110005.QAA00367@sun-lamp.cs.berkeley.edu>,
 > 	Daniel Carosone writes:
 > >I discovered that, while id(1) told me I was in group 0, su(1) told me
 > >I was not in the correct group to su.
 > >
 > >The su(1) program uses the getgrgid() function, which reads the
 > >/etc/group file for secondary groups. It does not look at the primary
 > >group. id and su should agree, this is clearly a bug, and a simple one
 > >to fix.
 > 
 > I'd say this is a bug.  su(1) and id(1) should agree.

Yup.  I just submitted a patch to fix this.

 > >I went to the source of id(1) to see how it extracted the secondary
 > >group membership from the kernel, so as to use the same mechanism in
 > >su(1).  I discovered that id also uses a variant of the /etc/group
 > >database file access routines, and so there is the possibility for
 > >disagreement between id(1) and the kernel.

All of this ranting is bogus, I was not paying attention to what I was
reading. id does behave as described above, but only when given a
flag.

 > >I find it very confusing when id tells me I am in the right group to
 > >su, and I can't, or when it tells me I am in the right group to access
 > >a file, and I can't.
 > 
 > This is how UN*X has been for a very long time.  Changing it would
 > certainly `feel' wrong.

Nope, apart from the general sentiment that Unix is often
inconsistent.  see above.

--
Dan.