delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/02/23/08:05:11

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B86DB3858283
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1708693509;
bh=/kpPgS+MJVUfUAktKiiyoED9ybOO1jagQZjPu0dTdjc=;
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=xz93OPhvCEDWSUEHH5L4u+3xN8oVkzdzgV7a/ddNBn489vGamsrGcPx5OazRXAhU+
utQFQluF/BFJq89swnYPZMilBXdMPNDvKiqmnjx3m7kTyTLuFamjj9cf6B6Q+IN8H2
sdPTeI9iCgoqbuONk6V923XtPnGCk2gegeFt/zWg=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C844A385840C
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C844A385840C
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
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: <CAKAoaQnFxij4Np-jg+bOLEpiSziCfamFrJ2FR_JeO+Sv_Td2Kg AT mail DOT gmail DOT com>
<ZdecXZNUgQ3i0hYN AT calimero DOT vinschen DOT de>
In-Reply-To: <ZdecXZNUgQ3i0hYN@calimero.vinschen.de>
Date: Fri, 23 Feb 2024 14:03:27 +0100
Message-ID: <CAKAoaQ=rCwVHnHAqfd5C3kC45GPE4ZHbbgCWrdM64sojLMuMyA@mail.gmail.com>
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=-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
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-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: Roland Mainz via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Roland Mainz <roland DOT mainz AT nrubsig DOT org>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 41ND5BbA016777

On Thu, Feb 22, 2024 at 8:11 PM Corinna Vinschen via Cygwin
<cygwin AT cygwin DOT com> 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 = (PSID) alloca (SECURITY_MAX_SID_SIZE);
>   NTSTATUS status;
>   ULONG size;
>
>   status = 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
-- 
  __ .  . __
 (o.\ \/ /.o) roland DOT mainz AT nrubsig DOT org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

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