| delorie.com/archives/browse.cgi | search |
| 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:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=DEX+heNgDmHosaQH0V+gnWqHFpKrj9P9DiJScrGx2rdP3etAb2YtO | |
| GcFWu6I0HbqgzCVfkWvSB6iZxxTQ0O4yhr8skeQNPTV6xtuuZK+eYfnas13rz+UM | |
| /d5/3Tqo7Tx6zQmzzZErqpIMqo0cwV218mk3hO3l5rXROwuqe38MJE= | |
| 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:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=ziSOhI5GKM9txkNqDEp9IHNZSaE=; b=az8fTcux+ORdv52udGbV3+544baT | |
| MY5FpprLcJrNFXQGb4Gi/bDvknlFMHFu8pUZbWKk/UmLWQfdr6nU5thx3lLbynYZ | |
| gwc01Rskg6tFaGASgurEcXL4xXSHUsqP6eLeTXWXC4HMwog+xxpTc49QG0hvuT9x | |
| U3fKyVCjVbFMTfQ= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
| X-HELO: | calimero.vinschen.de |
| Date: | Fri, 14 Mar 2014 17:30:26 +0100 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Getting groups you belong to in perl |
| Message-ID: | <20140314163026.GB2355@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| 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> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <1247713652.20140314170446@yandex.ru> |
| User-Agent: | Mutt/1.5.21 (2010-09-15) |
--Qxx1br4bt0+wmkIi
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Mar 14 17:04, Andrey Repin wrote:
> Greetings, PANEL Vincent (CIS/SIN)!
>=20
> >>> 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.
>=20
> >>> Under *nix, I get the list of users belonging to the group and see if
> >>> the current user is in this list.
>=20
> >>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.)
>=20
> > I'm using standard perl commands (getgrnam, getlogin, etc... :
> > http://perldoc.perl.org/5.14.2/functions/getgrnam.html) which are proba=
bly
> > using standard C libraries in the background (I hope). The doc explicit=
ly
> > 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.=20
>=20
> 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. 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 cont=
ain
> 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.
Corinna
--=20
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--Qxx1br4bt0+wmkIi
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJTIy6iAAoJEPU2Bp2uRE+grdgP+wfH9ynNIwZfCSXbKiOtI3ow
t0axwg9SPAUs3fi12uw83yGdr7IUFfM9kp9E0UwdAKYdnboZ6fsMViwVAL/7uaXM
VyGGMjRLxNaP1u0c2tQ3w7qRfeC7Tq6PXaEKv9FXhnJlKjtrYXvbap5WD8SGTE+U
nS5MpgAZPSg8qhkmOas9sVVw4IkAo0Vkv0wNKlkAwtI+hh8gFot24yH4wQo+i9SI
doHQvWDPh2Z7FLDHrxrmxFORojGzB+Xh/jCxdTKanSP8hi5EsYn6KzcMCEkkLc4U
4Gio1nPwaImGfLClb+okugp9aOJ0OMVh2Lr4yRyBURhclcNrxQdX4waBLkwdzcRV
rfkjrbISaW2zb2ZE3wwuE4+A9tXEj29JCDHEgWW5UzyP56K/MmdLBM03nwhbejBs
aYpefn9p0eXZn3WFHod8vtVt2xFGz3N/MnwPZExlvpGyX7cIupQiih7bUpNitTJt
v84oZkHtsLHR7T/XpLlCbc/42dRneLQFsod7ZScBxSYts6BpMx0bEdFxw96NZGFc
cccgiXt5KTw1yiKEEDne4zLtlPACHbjgYiTRzE4Yrc8OTtpq1rWt2JmZ53HEfeXU
e2BR6lOtzrICY9cVpx3yWvaPxWUG7uAMvnL/1izHm+mSKJCI+MtffOX7nV7J/Fat
pqFsVeVXME7kZ3x2RBaf
=GZ3B
-----END PGP SIGNATURE-----
--Qxx1br4bt0+wmkIi--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |