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:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=SgOhoPxZJj03WZ0hsdmi3p1xe4gaw2H2O0BQQ7KvlwX
	ASiNte1oY9mybayHPyafPCkBM+ZziJvFMZiioPNtK7goqKwlM9qcV0pjSNK2GDW4
	o6th7eaiLCIIuK71VridRgjOv9kwlAHi6ggEYMds5SgatUylsVCINWMXs/i2wQE0
	=
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:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 s=default; bh=L7cB1hEUmcRAbjLe71r+zQgW9Io=; b=kNdvq4wDkWsft7AWy
	Y7q7Bh5SzwAMYDwhX+XwA6PVRk42LEv5usBw2WZ1aDmucZ2p4cOk3Jj8sQIYRC8W
	1B7xckF1+WTqAtsjFY7pQlm6PbgsrnXPFxWR5D+TSUvJ8kQHnf0IqTYw3ssmlPQz
	tumSYalnx3ifE6xGZjtX+GvB9M=
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=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: mailout01.t-online.de
Message-ID: <546766FF.9010602@t-online.de>
Date: Sat, 15 Nov 2014 15:45:19 +0100
From: Christian Franke <Christian.Franke@t-online.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 SeaMonkey/2.26.1
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] TEST RELEASE: Cygwin 1.7.33-0.6
References: <545BD14A.8080803@t-online.de> <20141106200635.GP28195@calimero.vinschen.de> <20141106204222.GQ28195@calimero.vinschen.de> <545C68BA.3050007@t-online.de> <20141107101659.GU28195@calimero.vinschen.de> <545D30DA.9040507@t-online.de> <20141110105151.GB2782@calimero.vinschen.de> <54611048.4000404@t-online.de> <20141110204500.GB13071@calimero.vinschen.de> <5461AF09.5010809@t-online.de> <20141111113656.GP2782@calimero.vinschen.de>
In-Reply-To: <20141111113656.GP2782@calimero.vinschen.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Corinna Vinschen wrote:
>> The actual test scripts & tools from this use case pass local usernames
>> from/to non-Cygwin programs and rely on the fact that Cygwin and Windows
>> username match.
>>
>> For the long term, have some cyguser, cyggroup tools (similar to cygpath)
>> which convert the names would be helpful.
> Feel free to provide them.  I'm not quite sure what kind of conversion
> you're thinking about.  Cygwin->Windows?  If so, you can get that
> with simple scripts:
>
>    pwd_entry=$(/usr/bin/getent passwd "$username")
>    # Extract Windows username and domain
>    tmp="${pwd_entry#*:*:*:*U-}"
>    tmp="${pwd_entry%%,*}"
>    domain="${tmp%\\*}"
>    username="${tmp#*\\}"

Works, except when Cygwin does not provide a "U-*\NAME," in the gecos 
field. This is the case for Local Service, Network Service and 
Administrators.

Tested in db-only mode with 1.7.34-001:

   $ getent passwd localservice
   localservice:*:19:19:,S-1-5-19:/:/sbin/nologin


BTW, TrustedInstaller is not found by getent:

   $ getent passwd TrustedInstaller ; echo $?
   2

   $ getent passwd 328384 ; echo $?
   2

Same result for 'group'

but:

   $ ls -l -d /cygdrive/c/Windows
   drwxrwx---+ 1 TrustedInstaller TrustedInstaller 0 Nov 15 11:08 
/cygdrive/c/Windows

   $ ls -l -n -d /cygdrive/c/Windows
   drwxrwx---+ 1 328384 328384 0 Nov 15 11:08 /cygdrive/c/Windows

  $ getent passwd S-1-5-80-956008885-...
TrustedInstaller:*:328384:328384:,S-1-5-80-956008885-...:/:/sbin/nologin


What will be the future 'official' way for the opposite Windows->Cygwin 
conversion? Some tool that uses CW_CYGNAME_FROM_WINNAME ?

Christian


--
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

