From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id 2A0E4385842D for ; Mon, 11 Mar 2024 01:30:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A0E4385842D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A0E4385842D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::230 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 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2d41d1bedc9so36216861fa.3 for ; Sun, 10 Mar 2024 18:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710120648; x=1710725448; darn=cygwin.com; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=JDNnuy5sB7Rert0EoLQgwfMaObc4muLY9fktV8x5N0k=; b=SKRcGDNUZBmlOIhmMfr0SY3T1IOSen8BZnyrD+dFJhPH7YPHSpQ8YXZMFIjuE8btX6 vFbZ+kcAl5T2KSfhkpcFhxpD/mcovXNHHws7loRWtGwj8SkUmYNsY6p7wqj/TOCXh8WM 70TiFbYI9pm7Z7jyyPWmSK5PCVFYLigXsia4lpD9soH8W6rcwt+XJoaSBqWaIzdgejYp ZneoSm7hVjEpRqSd5sJuzMZtUTaMLJyQZdpjUBAkIOjlGtZpLiKRguI9l2ayokoR0eWH RwBRbS0boybGctSzvv2iK1Un/KMBnDsk6Lewj4wsugt/iVTE/c2uSjUcsV3uU1L9APLz HQfQ== 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: From: Dan Shelton 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@cygwin.com Content-Type: text/plain; charset="UTF-8" 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 List-Id: 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