From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by sourceware.org (Postfix) with ESMTPS id C844A385840C for ; Fri, 23 Feb 2024 13:03:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C844A385840C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nrubsig.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C844A385840C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.166.52 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708693444; cv=none; b=HvT9Hm9ZAQKD6BHUjPukWXjdA8GVpnBdK415r9sYKlDOmWurU5oSGJbePU1ZH7zoq8Sz/EWawdH7nVpGaB2s9C5ODUbnHxEJgVKlfBA0I/OkQ7yZizJPkoewEngf9Z+ZiLablIi04m5q6BS+j1yMvN4RAWV+3qRrhdRVA1i13XQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708693444; c=relaxed/simple; bh=3CGptsPx3tP1qG2O1nM+s+KT2onZnYmJHhqVRNtxbbo=; h=MIME-Version:From:Date:Message-ID:Subject:To; b=GvzX5YwEQIis+Ms/Y7hcr1tdS0mr6StGNAnAtPzbxXDR0/78nsk6Zunt7A23/D1c3hv5QAvkM2znBNn4FG7hR0Uh3TZWFb2yH81U5w3Hxwh9AuouzHQHRaM2UWu0PXIFo9E2ENLAWWuUpGovGZWorMxlR8aYNxZD/Nu7KS97tt0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-7c78573f31aso10414039f.3 for ; Fri, 23 Feb 2024 05:03:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708693434; x=1709298234; h=content-transfer-encoding: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=0/61V9CKQauEpzLIwwc1qc5kk1ErRi52xswaEuo/0+4=; b=hipZkO8Q6AP9vp/kjT69FAENlUDTNrwCtePHDajD0jRALKFI8bUv5COmzOlDO3wZwY 9bxeUo0almbfPJB7VP7Uhmc2B79NnD3eXpbpbGNwXxzQheogkh627EWRxSdk3elqnoCM ETUpFTQoyQuJ+rmesSXYJBGEEe8PllvXY7weQc9wk18mEDnMEfK1ydN2/Jci61/4rlkI LlZmYG11vWIEKTbIP/nvqxo46LZF4D1v+LAt/L2VAUDHnPDKxllAZOu4Kt0nsQlKLbGg jEPnWlXI5siivnJ2nstkfb+vJd1/MYecQyrrPoesorqR5aP2RnOkLixhtnF97B381OcT JEEA== X-Gm-Message-State: AOJu0Yz4Lj6d03iRNVEZw3sJvwb+P35tYoNNVGlaZW1PHER+9uKDFjsl Hw9I+Jf7wBi7LOuiRXAzJ6goMIFFEOay8iR0+5Dzg5GGHhsW/5ov1f8XuRuO/27pnGp8xDmND0i +vT+b5595n23dlDGNzg/s7rtQ0S8WDOCAvVQ= X-Google-Smtp-Source: AGHT+IGlAW0lusUt+IhNq22DIUThB439V+YEoxYDGy80OqlJ49+kh4DwsNfJcF9ftAffmv9ZMThZ+w05yVQT57Ypm7Q= X-Received: by 2002:a6b:d811:0:b0:7c7:a22c:ca07 with SMTP id y17-20020a6bd811000000b007c7a22cca07mr251306iob.5.1708693433535; Fri, 23 Feb 2024 05:03:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Roland Mainz Date: Fri, 23 Feb 2024 14:03:27 +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" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, Feb 22, 2024 at 8:11=E2=80=AFPM Corinna Vinschen via Cygwin wrote: > On Feb 22 18:38, Roland Mainz via Cygwin wrote: > > If I switch the current user's group with /usr/bin/newgrp, how can a > > (native) Win32 process use > > |GetTokenInformation(GetCurrentThreadToken(), ...)| to find out which > > group is the new "current group" (e.g. which |TokenInformationClass| > > should I use) ? > > PSID sidbuf =3D (PSID) alloca (SECURITY_MAX_SID_SIZE); > NTSTATUS status; > ULONG size; > > status =3D NtQueryInformationToken (hProcToken, TokenPrimaryGroup, > sidbuf, SECURITY_MAX_SID_SIZE, > &size); Well, it works in the case of an "hello world" application, but if I stuff that into the nfsd_daemon (NFSv4.1 ms-nfs41-client client daemon) it always prints the default primary group, even if the current thread should impersonate another user - or in this case even the same user, but a different primary group (e.g. see https://github.com/kofemann/ms-nfs41-client/blob/master/sys/nfs41_driver.c#= L1367). Do you have any idea what is going wrong in this case ? ---- Bye, Roland --=20 __ . . __ (o.\ \/ /.o) roland.mainz@nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /=3D=3D\ O\ TEL +49 641 3992797 (;O/ \/ \O;)