X-Recipient: archive-cygwin AT delorie DOT 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=AbGLu8mMK43QB2kJ OGTZSuq80BsnhLz/8OG60P1UoiM1+sxAzliUhr13fJA/MJS3a72aqqwq0tRtnUdE 3hzfCQVxmyQo2cSNOiwFnNVWYG81ALwXFGfH67slJxOfOOMhv/yH6MuA7qwV+yU3 Mx+t0s+KbgN1yUibsSJPrU/kqg4= 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=12MxNgZiqKZyBHLZDnIC4z NdsjQ=; b=S7T+GuwBZvUg3lrx4NshGmcBF0q7rgqrX9oYio6RwfpSm+ugGCatB3 s/spP0JM3i/Yv5/aAYBiXqOg1L260eJELhTddmLBx7ixYj3pZmzYanyOL6xRQP9P 2wIu+uMmb/1wzoSxjJgopLz6g7oC2f2y6rir/O+ZeqesRkdLnPmG8= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT 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 20:38:23 +0400 From: Andrey Repin Reply-To: cygwin AT cygwin DOT com Message-ID: <692018215.20140314203823@yandex.ru> To: Corinna Vinschen Subject: Re: Getting groups you belong to in perl In-Reply-To: <20140314163026.GB2355@calimero.vinschen.de> References: <09C6BA32B7B1654B8AB0CAF234F2A1C114E65CBA AT A04066 DOT BGC DOT NET> <1797360578 DOT 20140314023749 AT yandex DOT ru> <09C6BA32B7B1654B8AB0CAF234F2A1C114E65FAE AT A04066 DOT BGC DOT NET> <1247713652 DOT 20140314170446 AT yandex DOT ru> <20140314163026 DOT GB2355 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Greetings, Corinna Vinschen! >> >>> 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. > No, sorry. You don't know it yet, but you really don't want that. The > cost to generate full gr_mem info from the Windows user DBs in terms of > performance is prohibitive. I've had an itch about it, but I have no tools to check this functionality myself. Thanks for confirmation. > And it's really not required information > because there are other ways to fetch this info only if it's really > required: > - For the current user, use getgroups(2): > http://linux.die.net/man/2/getgroups > - For another account use getgrouplist(3): > http://linux.die.net/man/3/getgrouplist >> 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. > Or just use the older 2014-03-05 snapshot for the time being. Indeed, I did mean "current snapshots". Sorry. -- WBR, Andrey Repin (anrdaemon AT yandex DOT ru) 14.03.2014, <20:37> 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