From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id D9CAD3858D33 for ; Fri, 19 Apr 2024 23:45:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D9CAD3858D33 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 D9CAD3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::135 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 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-516d3a470d5so3208295e87.3 for ; Fri, 19 Apr 2024 16:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713570318; x=1714175118; 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=us3ACpawmmD/EGzThZ+WOywSEiQprgQ+bYunpONzMco=; b=JS5YPOlXfNvgpXYuC2H1knTC3bald5WGh9pb9gm4NSJKE8MDr4UsrkIvrUqatuLs+v YACWm9TpIrTiiLuXqTRY0BzFvpluJxWSbP+rUNzNu0V2jliwsrKMnWO2SHGnQMTOhHV6 mGv605Wk4PXOuFr78rC24EzGaHYZYUZJeGGbLFd2Za2XD0KfOjsA8RwIHzxj2xgysL1V bRQxguso12LtTlY4pKo4pcbzpWR7BRil5MkECPskI0wqbF2/+UmmVNrTWBmNdboayftr ca5NBeenDXQDsIgsoedlx+yEWzkmX8PgkD8Z+2yenJUWcdAStaahZzL+P7b0+Xw2i+Ro LRTw== 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: From: Dan Shelton 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@cygwin.com Content-Type: text/plain; charset="UTF-8" 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 List-Id: 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