X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 343E93858288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1713570347; bh=pdzd7oSygPdqwCrrwLPm9VUf120HEovOGJJtgTZZOrY=; 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=RYOtq3hr7vDa7cSGKFKfztIuC3Mpst4U3tEpS3XtVGTUdsrRBx7JzHTPqNMqHcLG8 8ZBc13xWKPNcZLuh0CnE8vgQ98RqwyLniAqF2BORXosf0idoqYn8/GlfnoFwiuP+BX s6nk/cqyhTt9to1XRUV+1iiUyL6Q31wcsgOOJfgw= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D9CAD3858D33 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D9CAD3858D33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713570321; cv=none; b=VkedYzYda7UI07ktFtF2UdmjXdmetqbroD6M+JKGbkNdivAjemSPVmRhuyttCmQdLd7agG+UwnNRRj+kBw0I/9tT/KVivIDQksRWkGrhxFWksON7dCZz6Sh2NXDWQnNL569PZT6PpJ/uBrcUj63Gh1xFw16YiUwUXlZfnxirGwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713570321; c=relaxed/simple; bh=GLUCt0h0UvJYiyBMIR5a0f/F/Q6BHjtssVRJf5h8Cn0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=lYrVqElZw+9iDxMcMtdIg+9RuYnbCoJFBns0a0nIWHLKJaMWBC7bXQnFJP2XK028P3f/5RJIEUdRLMT/NFFHuAc6nsNtTs60YrSaU4KcovBMwQrl9/oQ7/xnLKCIvQiUZUl+hyvvnqKp62EGDVyf2QjbWcbcqQB8gIP20SzyfZk= 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=1713570318; x=1714175118; 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=us3ACpawmmD/EGzThZ+WOywSEiQprgQ+bYunpONzMco=; b=Y5gSJ2wqmWSlJ6a/8q+Iwpe3IICf8uYjs110YXVhyKswfkWyGpGSoURCkWurVRm5vH DXi/mWP7/FDEBF7sxDxWJjJkHbO+v30hGn+DFVX0aI6pNbGRGetwtVfG4QWnFeDmLlVj vbKEulg5Gqh2szoI9zEfpaXL462xWguskpoEZpK5mk52iIk5DZ6xKQ3E0lSMEZeoU8xr rrn904dLSlXbx+eVrTp1jt/3oozVZyWRqNY3sA2m+S/kaVISAkpsQk8RHNc7kKS6WAKY lUcd/xWWsAg8aVJMsg3Za3a6OEFVATPqgeQJSFgYE/hTWR/655l0rM5g+5Ig8UfZ+VKQ qDRA== X-Gm-Message-State: AOJu0YzcdqNQ2rzdknEc0ScAxpeuaPJdOTzRcfkmWwApxwk3QlryQRDo 7+UWOiDMS2lPsEv3JrmdnXecJK4R01dnZexv3Nc97NMLkJWSm8W0MnuS0M9Uocq8LQvdBFPfxBW YhStGZn0F8nqhvEL4fEmdcZH1u8TgfQ== X-Google-Smtp-Source: AGHT+IH/eT+KJPLd/FmTypc3kWJfUIO/wnLQsXmLsY5lUl4UH/LBOEbgZIsaa3kELPhAiRIHFIQvU0nKq6TDNO9qjKo= X-Received: by 2002:a05:6512:23a8:b0:51a:ca75:9ffe with SMTP id c40-20020a05651223a800b0051aca759ffemr2261947lfv.42.1713570317968; Fri, 19 Apr 2024 16:45:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 20 Apr 2024 01:44:51 +0200 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.3 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 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 Mon, 11 Mar 2024 at 17:57, Corinna Vinschen via Cygwin wrote: > > 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. That file is read-only for some customer installations, and we are not allowed to touch 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. net localgroup changes layout and messages per system locale. That might be nice to watch as a human user, but impossible to write a parser. That damn thing does not honor LC_ALL, and I am now basically forced to write custom parsers for each customers language. 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