X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:reply-to:message-id:to:subject
	:in-reply-to:references:mime-version:content-type
	:content-transfer-encoding; q=dns; s=default; b=bQohUDB4hQlOpCtd
	yPhuLF3Yp+OUEYUiaA7NVGTvx6VyAIIwm9TsaUPLlzLDbmLq1LxAVI/ALGD9Ai9f
	pjrlG3QjEIhy2CXqwbE5ncTmoIWQ2iT2NkePdST7D58pDUkKDMRrVVNSw0aiBGdk
	2KkShzSkzQcbZxEKf2L0qHKiwwA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:reply-to:message-id:to:subject
	:in-reply-to:references:mime-version:content-type
	:content-transfer-encoding; s=default; bh=Fp+HprcWNnMrQrmBZ25aID
	1EUqI=; b=WxZiBqL1wjDNiZxLtGRbbqswxZw46DiymnyMO3kb3aPQA9QPZ8uk9B
	kcOJmSIaKK92iTvDAR+hOkvGcX1fZ8bn+p31rFu74KtID2tGAEUiTL2E70DJ9+UJ
	SvDjl7xCVjrwAnP2jUs9GBnGEARwxPxx0tEYo+g+bfJic/AIMumFA=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_BL_SPAMCOP_NET,SPF_SOFTFAIL autolearn=no version=3.3.2
X-HELO: smtpback.ht-systems.ru
Date: Fri, 14 Mar 2014 17:04:46 +0400
From: Andrey Repin <anrdaemon@yandex.ru>
Reply-To: cygwin@cygwin.com
Message-ID: <1247713652.20140314170446@yandex.ru>
To: "PANEL Vincent (CIS/SIN)" <Vincent.Panel@belgacom.be>, cygwin@cygwin.com
Subject: Re: Getting groups you belong to in perl
In-Reply-To: <09C6BA32B7B1654B8AB0CAF234F2A1C114E65FAE@A04066.BGC.NET>
References: <09C6BA32B7B1654B8AB0CAF234F2A1C114E65CBA@A04066.BGC.NET> <1797360578.20140314023749@yandex.ru> <09C6BA32B7B1654B8AB0CAF234F2A1C114E65FAE@A04066.BGC.NET>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

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
>>information.)

> I'm using standard perl commands (getgrnam, getlogin, etc... :
> http://perldoc.perl.org/5.14.2/functions/getgrnam.html) 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.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 14.03.2014, <16:58>

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

