delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/11/12:57:20

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 914C7385840D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1710176239;
bh=Mj5RvMrWjGEtBcdqx5epkIRp1bW+ZaaA73BVWk/kdOE=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=opi3tSttnuuS0BaIi4f46s4QG8+FaP8vfnaQl+WwHMrzWlaTLWqwADTRIlSShmnxV
USlpfc6IJ/Gb1ijC+r74mJIuEI5zqCg/FfeSN4vaq1uqz0DbFCZDoX1btluWqxmAug
s7Ob0l68PT8s60SfMYjMge/wXk/tuyC83r+3pflc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 322BA3858D20
Date: Mon, 11 Mar 2024 17:56:59 +0100
To: cygwin AT cygwin DOT com
Subject: Re: Switching groups with newgrp - how to get the new group with
|GetTokenInformation()| ?
Message-ID: <Ze83202vozq9T8Jj@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAKAoaQnFxij4Np-jg+bOLEpiSziCfamFrJ2FR_JeO+Sv_Td2Kg AT mail DOT gmail DOT com>
<ZdecXZNUgQ3i0hYN AT calimero DOT vinschen DOT de>
<CAKAoaQ=rCwVHnHAqfd5C3kC45GPE4ZHbbgCWrdM64sojLMuMyA AT mail DOT gmail DOT com>
<Zdi-CnGX3CwWA0nl AT calimero DOT vinschen DOT de>
<CAKAoaQ=kLW3houqanjcN9Qk1++BtgW-dNRiXjLYwCRTYEzoN=w AT mail DOT gmail DOT com>
<CAAvCNcCHAVooYX2_tUHHnUYvWRKHWhBwxmKws7AcqjOo-sQd+g AT mail DOT gmail DOT com>
<Zdnq5yJha75NTpgd AT calimero DOT vinschen DOT de>
<CAAvCNcAEAr0gFdR_excafHq8+cYjDvf_APb1So-AAWGSu2+zTQ AT mail DOT gmail DOT com>
<ZehpEr18QUP6C3Ge AT calimero DOT vinschen DOT de>
<CAAvCNcCcfO9br8avaNo6tg-FLHef4aH9P8AVyr95bs9ArTTSJQ AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAAvCNcCcfO9br8avaNo6tg-FLHef4aH9P8AVyr95bs9ArTTSJQ@mail.gmail.com>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Mar 11 02:28, Dan Shelton via Cygwin wrote:
> On Wed, 6 Mar 2024 at 14:01, Corinna Vinschen via Cygwin
> <cygwin AT cygwin DOT com> wrote:
> > On Mar  5 23:38, Dan Shelton via Cygwin wrote:
> > > 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.
> 
> We're trying to do several things, including but not limited to:
> - Finding which local groups exist. Part of our customer software
> expects that certain groups exist. Unfortunately the group names vary
> between installations, and sometimes names are prefixed with site
> names. Trying to do all permutations with just getent passwd
> $iteration means too many combinations (>= 4000000). So just
> enumerating all local groups with getent group would be the way to go.

Then just change /etc/nsswitch.conf to enumerate "local" as well
and be done with it.

You can even go so far as to use the Windows enumerator, i.e.,

  $ net localgroup

and than script it to use its output as input to getent group
for only the groups you really need info for.


Corinna

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019