This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "id -Gn" w/ username doesn't return all associated groups. Issue with getgrent()?

On Jan 22 06:03, Eric Blake wrote:
> Hash: SHA1
> According to Corinna Vinschen on 1/22/2007 2:34 AM:
> >> When "id" is called without a username, it calls the getgroups(...) function
> >> which appears to work as expected.  However, when a specific username is
> >> passed, even the username of the current user, getugroups(...) is called,
> >> and does _not_ appear to work as expected.
> > 
> > That's by design.  getgroups() has access to the user token of the
> > current process and returns every group which is in this token.
> > getgrent() is a function which enumerates /etc/groups.
> So my translation of this would be that the bug is not in id, but in the
> fact that your /etc/groups is out-of-date.  Use mkgroups to remedy the
> situation.

A little bit more specific:  Use the mkgroup -u flag.  By default,
mkgroup does not add the users to the gr_mem field since that's not
necessary for correct operation of setuid(2).  By adding the users
to the gr_mem field (the -u option), you probably get what you want.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]