X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1573A385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1691105974; bh=2F7d0aBYHcPpDroAluOofRd8J2/g1bVvUpN0WdDFr+M=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=qn2lmfn2GB5PyozXIDde+iwKVjrPEJ7eOl/BEU/SMeGKL1JAcRj233MJgDO1ZP+g9 WbM+rCeeOVIu++gyKflMg2ytsBHNztB3hQoCdWm10McbliDjXWIVKQyZrcFRte0qHC llSrddSnBmOYoTrq9/pjnBM0/GJ72t0FWmqpWck0= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 175243858039 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691105934; x=1691710734; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0lmcg4E1d+nARQ6cZLmH8dvNyyy9dLfhI4Eq4/XwKY4=; b=ZwaEYLin36dEF4iUWbULlMLXqNtSUZxQUtnRM2ZRu5XmVpzGJyW8Cqa3WLwPx0UVD8 BJswM02dX7fBgMczxM1j6pBXH3fL6uypLwUWYX7GKcdVI0KE3//2djzEj/DvUBOPhGg4 VVueNhZlor7v/XFzz7IN+Bjzcb1JZV/wQOPMB9yCt5HU/jqSJ29dVZy2wqOqLnO0O2TY s8+iCMllQuQ4lbXwYTBVkB52Hs6tL9iFlTWJHV6u36hkjjEnHwHWBV+Clp3nXgbm27HA gVd5xLndfWU7CsaQEKyz5n1pNp6pEWjNC66CiU8f2RjeAKuPRwtc/SprqqWFuDKjnCpC eJ0w== X-Gm-Message-State: AOJu0YxY08iWSCKFbsNgh8isegkxR/JiX4BzHNPdLVrHI/+Mo+tpMlHw 2jzuwpDEhOxV/AP+4Hv0CU4hSnhlG4sJgOF7BeI= X-Google-Smtp-Source: AGHT+IGeKIOqQ5aJCzhUtXxChJoP2RPTFYcvqcZGpR7Ke7aavo+8mA29avbORMdOpsrAsjo1EW6gsfr1mCqEvthMFmM= X-Received: by 2002:a4a:9209:0:b0:56c:cec7:453 with SMTP id f9-20020a4a9209000000b0056ccec70453mr315214ooh.2.1691105934345; Thu, 03 Aug 2023 16:38:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 4 Aug 2023 01:38:42 +0200 Message-ID: Subject: Re: ms-nfs41 mount: Where does Unix_User+0 and Unix_Group+0 come from? To: ms-nfs41-client-devel AT lists DOT sourceforge DOT net, cygwin AT cygwin DOT com X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URI_DOTEDU autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Martin Wege via Cygwin Reply-To: Martin Wege Content-Type: text/plain; charset="utf-8" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 373NdZ07021656 On Fri, Aug 4, 2023 at 1:07 AM Martin Wege wrote: > > On Thu, Aug 3, 2023 at 8:46 PM Martin Wege wrote: > > > > Hello, > > > > We are working to deploy the ms-nfs41-nfs-filesystem on our Windows > > machines, and encounter some issues with Cygwin (latest stable). > > > > For example, if we go to the ms-nfs41-nfs-filesystem (not the NFS > > version 3 client from Windows!!!) with cd X: ; cd tmp/data9/, and do a > > ls -l we get 'Unix_User+0' and 'Unix_Group+0' for user and group > > names. > > The question is: Where do these names come from - Windows, > > ms-nfs41-nfs-filesystem or Cygwin? > > getent passwd and getent group do not list this on Cygwin. > > NFS version 4 server "lordbatman" has user mlw=uid(3620) and group mlw=gid(3620) > > > > Steps to reproduce: > > 1. Download and install cygwin. > > 2. Download http://www.citi.umich.edu/projects/nfsv4/windows/120612/ > > and install it. > > 3. Start NFS version 4 client daemon: > > ms-nfs41-client-x64/nfsd_debug.exe -d 3 --noldap --gid 3620 --uid 3620 > > 4. Mount NFS version 4 directory: > > ms-nfs41-client-x64/ms-nfs41-client-x64/nfs_mount.exe -p -o sec=sys X > > 'lordbatman.bias.dfn.de:/export/home/mlw' > > > > Expectation: > > Cygwin ls -l should list file user/group as mlw/mlw > > > > Actual results: > > Cygwin ls -l lists file user/group as Unix_User+0/Unix_Group+0 > > Did a cygwin source clone, and found this: > cygwin$ grep -r -E 'Unix_(User|Group)' . > ./newlib-cygwin/winsup/utils/mkgroup.c: "Unix_Group", > ./newlib-cygwin/winsup/utils/mkgroup.c: "Unix_Group", > ./newlib-cygwin/winsup/utils/mkpasswd.c: "Unix_User", > ./newlib-cygwin/winsup/utils/mkpasswd.c: > > But I do not understand this code. In which cases are Unix_User+0 and > Unix_Group+0 used? It just got more mysterious. I tried a ls -nl (uid, gid as numbers, not names from /etc/passwd and /etc/group), and got this: ls -nl total 78474 -rwxr-xr-x 1 4278190080 4278190080 33063 Aug 3 12:02 CMakeCache.txt drwxr-xr-x 1 4278190080 4278190080 374 Aug 3 12:51 CMakeFiles -rwxr-xr-x 1 4278190080 4278190080 4790 Aug 3 12:02 CPackConfig.cmake -rwxr-xr-x 1 4278190080 4278190080 5276 Aug 3 12:02 CPackSourceConfig.cmake -rwxr-xr-x 1 4278190080 4278190080 440 Aug 3 12:03 CTestTestfile.cmake -rwxr-xr-x 1 4278190080 4278190080 77004 Aug 3 12:03 Makefile So where does the "4278190080" come from, for uid and gid? Hexadecimal its 0xff000000, which might be related to this: ./newlib-cygwin/winsup/cygwin/local_includes/security.h /* For UNIX accounts not mapped to Windows accounts via winbind, Samba returns SIDs of the form S-1-22-x-y, with x == 1 for users and x == 2 for groups, and y == UNIX uid/gid. NFS returns no SIDs at all, but the plain UNIX uid/gid values. UNIX uid/gid values are mapped to Cygwin uid/gid values 0xff000000 + unix uid/gid. This *might* collide with a posix_offset of some trusted domain, but it's *very* unlikely. Define the mapping as macro. */ #define UNIX_POSIX_OFFSET (0xff000000) #define UNIX_POSIX_MASK (0x00ffffff) #define MAP_UNIX_TO_CYGWIN_ID(id) (UNIX_POSIX_OFFSET \ | ((id) & UNIX_POSIX_MASK)) But why is it then Unix_User+0 and not Unix_User+3620 on Windows NFS? Same for Unix_Group+0 vs Unix_Group+3620? Martin -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple