odd issue when running dbus-launch [cause found, but no fix found yet]

Thiago Macieira thiago at kde.org
Tue Dec 19 09:09:28 PST 2006


Vulpes Velox wrote:
>On Tue, 19 Dec 2006 07:45:48 +0100
>
>Thiago Macieira <thiago at kde.org> wrote:
>> I know. What is the value of ng after that happens?
>
>I must be a little confused, after what happens?

After getgrouplist returns -1 (failure).

>ng never changes once it is set.

Then the bug is in your glibc. The man page specifically says:

RETURN VALUE
If *ngroups is smaller than the total number of groups found, then get‐
grouplist() returns a value of ‘-1'.  In all cases the actual number of
groups is stored in *ngroups.

(Note the last sentence)

>The error happens because I have created a user that is in more
>groups than the value of ng allows for.

I know. But getgrouplist should be returning the number of actual groups 
so that the second call succeeds. The example I gave you is an almost 
exact copy/paste from the getgrouplist(3) man page. I just changed to 
make it try 17 on the first attempt, instead of 0.

>DESCRIPTION
>     The getgrouplist() function reads through the group file and
>calculates the group access list for the user specified in name.  The
>basegid is automatically included in the groups list.  Typically this
>value is given as the group number from the password file.
>
>     The resulting group list is returned in the array pointed to by
>groups. The caller specifies the size of the groups array in the
>integer pointed to by ngroups; the actual number of groups found is
>returned in ngroups.
>
>RETURN VALUES
>     The getgrouplist() function returns -1 if the size of the group
>list is too small to hold all the user's groups.  Here, the group
>array will be filled with as many groups as will fit.

You have the BSD version of the man page. But the promise to store the 
actual number of groups in the ng variable is there (second paragraph of 
DESCRIPTION, last sentence).

Is there a chance this is an isolated bug on your libc or NSS 
implementation? If it's not isolated, we'll need to add workarounds for 
all the broken systems out there.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20061219/3541ec6b/attachment.pgp


More information about the dbus mailing list