From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 322BA3858D20; Mon, 11 Mar 2024 16:57:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 322BA3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1710176222; bh=9uWnVDn33E1MY2vUfDbArdwp2+NQ6CQqFvj2WFpQ83s=; h=Date:From:To:Subject:Reply-To:References:In-Reply-To:From; b=VDqBepcmnSzVUBpVwvfGv/2m32e3IJsB7MT1/rUNy7oRMRGojOkiO6euBRZjp2tnm A4HVMrGXlqoD1Z+h5lJH5zz20Kjr50PS5sImo9q9I9RfEG6g/pcT7J5WApzmu5TVFM Ec2RHV8917Xj0reOh557kaZaeFA8EfigmPJOIGLI= Received: by calimero.vinschen.de (Postfix, from userid 500) id 593D3A80B87; Mon, 11 Mar 2024 17:56:59 +0100 (CET) Date: Mon, 11 Mar 2024 17:56:59 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Switching groups with newgrp - how to get the new group with |GetTokenInformation()| ? Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: On Mar 11 02:28, Dan Shelton via Cygwin wrote: > On Wed, 6 Mar 2024 at 14:01, Corinna Vinschen via Cygwin > 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