X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3FA638582BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1710120676; bh=FQ8Nh1Vlq2lcY+VmAUoSXNk5wNpTg5EtywKjLWkfvPA=; 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=S6sPVwiKKmPwyieTjOKRiDrPPdfRwOUC/j4YZI0uG7ZvP4Ov/ttftQG2rDwbVfaAA RqdwB5hliNKiGqNUS/aOxaPjbxDTGsmdgcyh1S9wf/B3PXJU+eMcjN24RBpPSDMIFP OgFps+cKHCHx0D9+180tOMYPfZGaMEZwg47nkH1Y= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A0E4385842D ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A0E4385842D ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710120653; cv=none; b=FG3iMU5sdzLgs40uPdP9w9rnPbfZw5W630M+Rqkm4gR1q94Y70hIgLTLTjN69TjMrLq5oRm8yVCqTGuDWfeVt/aI+kQ+xoo6B66d7NBvSa8r0zwx2UI5qQnv4yzUp7uNRlnhgXUq7RCtnBBXWDRJG/vi/6KFNw/16+rCoY2zyoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710120653; c=relaxed/simple; bh=2v6KBNJ3P1SVCk3qryVpKfPYLca3ey/q4MTKFPcXnaQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=H09655X40QRo5/Dsht3FXMIXXOxm94PK6cgkwlbovX8IKXQu2JpPYYv8cjQ+vglcV/nj5mLjwNMRa6SOogdyIPQqR671nEFb5g2lLvgcQrGWCOL6TC4gJkMxx+tP/iuN2UqFFc56K69POsWPMHw+yKgqzp0iD/hxyE7AqS3vKDE= ARC-Authentication-Results: i=1; server2.sourceware.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710120648; x=1710725448; h=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=JDNnuy5sB7Rert0EoLQgwfMaObc4muLY9fktV8x5N0k=; b=lmb4kXm3WfwJ7QLtk2RV53z0teBfaKMt+t079xY5Z9qWz1IQef9ehVHEieC8a2ZsfW MxNuRHGBJFqQ5fKWE8U60XHsE4EmY0UDecIa4W77SqjikLcEQBZfxC1YtYPLT4JX8tkS b7H7k5b4BSt9+s8yZbOXtvg9s0229uOy1qCKB67MhAPFkegWbbFyly6CAKCUK3cqb88T Pbc/Sr862cYlS1gb2wcVZ4iH9B/NMKXQqkeAWfaUkt/nFvomVxWfcr4t+WSM1ep4sRb7 ep0X9pUXek8OzgdoYBiOX8ivoBP3KQpNu1PgvG4bWPkhOAlze5Vf6HU7CvkVpmSxtzbI 5n2w== X-Gm-Message-State: AOJu0YwqBXI1Tx6ZGQBZJzauQaQQvnWAujYtZ7Xj3y796d7b7iPoTFVK Uek89fjSt5raWLfYmpfQ/0cwvCgxSTScN/5BeOhccKWxCCernm4jaCzvWe9dcMRqGfSna7Y6avU stoENq5CkJfZ8kaOg0kvN8kSAdDPfyH2Z X-Google-Smtp-Source: AGHT+IEt/KJhLpfiTwjWqJpniVxyLCJVH/H/Z2L18mF0afQF/ABg2B0HBsw5xQGDG6DuJu8lWKEza++mhx5m/fWrNXA= X-Received: by 2002:a2e:8e3a:0:b0:2d2:a8b3:a20e with SMTP id r26-20020a2e8e3a000000b002d2a8b3a20emr2855751ljk.53.1710120648057; Sun, 10 Mar 2024 18:30:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 11 Mar 2024 02:30:17 +0100 Message-ID: Subject: Re: Switching groups with newgrp - how to get the new group with |GetTokenInformation()| ? To: cygwin AT cygwin DOT com X-Spam-Status: No, score=0.1 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 autolearn=ham autolearn_force=no version=3.4.6 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.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Dan Shelton via Cygwin Reply-To: Dan Shelton Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" On Sat, 9 Mar 2024 at 22:27, Glenn Strauss via Cygwin wrote: > > On Wed, Mar 06, 2024 at 02:01:06PM +0100, Corinna Vinschen via Cygwin wrote: > > On Mar 5 23:38, Dan Shelton via Cygwin wrote: > > > On Sat, 24 Feb 2024 at 14:11, Corinna Vinschen via Cygwin > > > wrote: > > > > > > > > On Feb 23 22:15, Dan Shelton via Cygwin wrote: > > > > > HOWEVER, there is another Cygwin bug: > > > > > "getent group mywingrp1" does not list any group members, even after > > > > > "net localgroup mywingrp1 mywinuser44 /add", which is a POSIX > > > > > violation. > > > > > > > > Not a bug. Two problems: > > > > > > > > - Getting members of a group can be an extremly costly operation > > > > in a domain or, worse, a domain forest, or even worse, if the > > > > domain or domain forest is remote. > > > > > > > > - Alonmg the same lines, getting members of a group can be extremly > > > > costly in big orgs with thousands of users. Nobody want's to clutter > > > > up space with the list of members in the "Domain Users" group. > > > > > > > > - Permissions to enumerate members of a group are restricted. > > > > By default only admins and group members are allow to enumerate > > > > members and this can be restricted further by domain admins. > > > > > > > > Therefore we dropped even trying to populate gr_mem, considering > > > > that even in its original form on Unix systems, it's used only > > > > to add supplementary groups. To do this right on Windows is even > > > > more costly than blindly enumerating. > > > > > > > > It's not a bug, it's a feature :) > > > > > > Could you add an option to getent so that the full lookup can be > > > requested via command line, pls? > > > > That's not possible. getent just calls getpwent/getgrent. > > > > > Always editing /etc/nsswitch.conf > > > forth and back is not a elegant solution, aside from race conditions > > > with other users on a system > > > > So, here we go again. > > > > - What exactly are you trying to accomplish by enumerating the accounts? > > Maybe you won't actually need it for your task at hand. > > > > - Why do you have to change nsswitch.conf "back and forth"? > > Just change it once and you're done. > > > > > > Corinna > > Hello > > > Dan Shelton - Cluster Specialist Win/Lin/Bsd > > > > Always editing /etc/nsswitch.conf > > > forth and back is not a elegant solution, aside from race conditions > > > with other users on a system > > Please check the man page for getent. > > man getent > getent --help > > You can use -s or --service to override the service used without > editing nsswitch.conf. The man page on Linux provides an example > with a bit more details than the man page for getent under cygwin. > https://www.man7.org/linux/man-pages/man1/getent.1.html Is this feature supported under Cygwin /usr/bin/getent? I tried it, but did not see any change. Even putting garbage into it, e.g. /usr/bin/getent -s "$(man man)" group foo does not yield an error. Dan -- Dan Shelton - Cluster Specialist Win/Lin/Bsd -- 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