This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


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

Re: libc/1565: getgroups() returns wrong number of supplementary


   From: kareemy@earthlink.net
   Date: Mon, 31 Jan 2000 15:31:19 -0500 (EST)

[To people on libc-alpha: If you do a "wide" reply on this message, it
 will also go into the bug report database]

   Mark,

   I ran that program and it indeed prints each supplemental group
   twice with the following output:

   [output snipped]

   I appreciate your help. Do you have any more ideas on what I can
   check to make sure I did not misconfigure anything when i compiled
   my glibc 2.1.2 libraries since everything else works.

In the mean time I have been able to reproduce the behaviour.  It's
not a bug but a feature...

Let me explain.  What initgroups() does is scan all groups in the
group database (traditionally /etc/group in UNIX) and install the IDs
of all the groups that have the right user as a member as
supplementary group IDs.  The way initgroups is implemented in glibc
means that if you have a duplicate group entry in the group database,
it will add its ID both times.  Normally this isn't a problem since
people generally do not have duplicate entries in /etc/group.
However, glibc has this nifty feature called name service switch.  It
can collect its data from several sources (NIS, NIS+, hesiod,
databases in /var/db, files in /etc) in a transparent fashion.  It is
much more likely that one of these services duplicates information.
This is especially true if you use the "db" nss module, since its data
is generally generated form the data for the "files" nss modules
(/etc/group).

One could argue that initgroups() should remove duplicates before
calling setgroups().  Are there people that think that should be done?

For now, if the problem annoys you enough, removing "db" from the line
that starts with "group:" probably will do the trick.

Mark


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