Igor Kovalenko <Igor.Kovalenko@motorola.com> wrote:
: ???
!!!
Geeze man it isn’t like there are a few things that other people
are remarking on =;-) … we didn’t forget about you … remember
you got a shirt!
: Igor Kovalenko wrote:
:> Few quiestions:
:>
:> Why does getgroups() always return 0, even when process uid has
:> supplementary groups?
Because there is/was a bug in the getgroups() routine. It is
fixed now, but won’t make the next patch unfortunately. To
work around if for the time being, always pass in NGROUPS_MAX
to the getgroups() routine (along with an array of NGROUPS_MAX
of course). It was the 0 value that was messing up the function.
:> Why doesn’t ‘id’ utility print suplementary groups for a user? Because
:> of the above, huh?
It does print the values on my RTP system …
% cat /etc/group
root:x:0:root
[snipped for brevity]
ftp:x:80:ftp,root
guest:x:90:thomasf
nobody:x:99:thomasf techies:x:120:
% id
uid=360(thomasf) gid=120(techies) groups=90(guest),99(nobody)
The catch here is that if you modify the /etc/group entry
and then do id without re-logging in (since that is where
the initgroups() call is made) then you don’t see the
updated values.
:> Why do headers define NGROUPS_MAX as 8, _SC_NGROUPS_MAX as 4 and
:> _POSIX_NGROUPS_MAX as 0?
I have NGROUPS_MAX = 8, _SC_NGROUPS_MAX = 8 and _POSIX_NGROUPS_MAX = 0.
Here is the rational for the values:
Posix section 2.8.2 states that the symbols defined
in <limits.h> (which includes _POSIX_NGROUPS_MAX) shall
be defined with the minimum values shown (ie 0 for
_POSIX_NGROUPS_MAX). These represent the very minimum
that a POSIX system would comply to (ie no process
group support). Conforming implementations provide
values at least as large as these values.
NGROUPS_MAX is a specific implementation instance
(as described in section 2.8.3) which is allowed
to be higher than the value defined in <limits.h>.
However, since this is a potentially run-time
variable thing, the specific instance shall be
provided by the sysconf(_SC_NGROUPS_MAX) function.
Phew … there you go.
:> Why does initgroups() has to be different from Unix?
As far as I know it isn’t different from other Unix
systems … if it is then let me know how and we
will see what we can do.
:> I’m trying to be nice, but I want to SCREAM! Just spent 2 days trying to
:> understand why something does not work, under assumption that C library
:> functions do what they’re documented to do. Try example from getgroups()
:> doc…
Sorry … thanks for pointing out a problem and
helping us to get a fix in for it.
Thomas
Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf