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: Getting groups you belong to in perl

Greetings, PANEL Vincent (CIS/SIN)!

>>> Don't know if this list is more appropriate than the Perl one but my
>>> question is actually about porting a Perl script to Cygwin. I need to
>>> check if the current user running the script belongs to a pre-defined group.

>>> Under *nix, I get the list of users belonging to the group and see if
>>> the current user is in this list.

>>How exactly you are doing this? (I hope you're not reading it from
>>/etc/group, because that file may not exist at all, or contain exactly
>>zero relevant

> I'm using standard perl commands (getgrnam, getlogin, etc... :
> which are probably
> using standard C libraries in the background (I hope). The doc explicitly
> says "The $members value returned by getgr*() is a space-separated list of
> the login names of the members of the group" but it's always empty under
> Cygwin. 

The functionality you're looking for may(or may not) be available soon(tm).
Corinna doing some rework of the core user/group handling as we speak.
Check the "Testers needed: New passwd/group handling in Cygwin" thread(s).
Do note that in the light of upcoming 1.29 release, snapshots do not contain
the code in question. You'd need to rebuild DLL from CVS to get them.

>>> Cygwin doesn't allow this way of working.

>>Oh... ?

> Yes indeed, the standard perl functions work but they always return an empty
> list of group members, similar to mkgroup.

Makes sense, now, that you explained it.

Andrey Repin ( 14.03.2014, <16:58>

Sorry for my terrible english...

Problem reports:
Unsubscribe info:

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