in reply to Re: Retrieve unix group membership for a uid in a perl CGI
in thread Retrieve unix group membership for a uid in a perl CGI

And then you move to a system running NIS or LDAP and miss anything not defined in the local /etc/group file. This is why you go through getgrent which uses the system's group reading libraries and honours nsswitch.conf (or whatever).

Replies are listed 'Best First'.
Re: Re: Re: Retrieve unix group membership for a uid in a perl CGI
by matija (Priest) on Apr 09, 2004 at 18:41 UTC
    I was going to use getgrent, for the guy's answer, and I couldn't get it to work.... Until now: I just realized that instead of looping through /etc/group, you can loop through getgrent.

    The thing I didn't immediately realize is that getgrent returns different values on subsequent calls.

    (Since I've never done this particular thing before, I was testing the code before posting...)