From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by sourceware.org (Postfix) with ESMTPS id A4ED33858D39 for ; Sun, 25 Feb 2024 21:04:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4ED33858D39 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 A4ED33858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.166.50 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708895099; cv=none; b=KjnHHe07BymeFJ1vz4rFmWEyVjoBlY5QB3c6+NC0RYcLHWbLbjOA92b4XXgMCJf9IJVqchvaylielNKA6cxC7DrBnlmPJXop8PpPeTTV5M2cwISq3RQlQAk6Lt8aKTAIGREN24eUrtUi314a36PtzNW3VZ3VckEQWugQsngADIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708895099; c=relaxed/simple; bh=mdDeacNwIQwix0f7zJPGtKoKnMZ1CsJCTa1/b4J6J0k=; h=MIME-Version:From:Date:Message-ID:Subject:To; b=rsMtvSTOP0o7vIQoikeAyFzZrvBxlq+2HX9g2EDedied8BeCYcO/SsV5NU2tv2C9ngTNePQ6476jofh6Y28LkGyQqW+FErhnQLztleH0IWOrzI+4Q+wn51iMognAnmW3IX5uf+XEzx23KKpSvzMFbCvQVnjKmEr/yaC44hwjkd4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-f50.google.com with SMTP id ca18e2360f4ac-7c48e13e0d7so152784539f.1 for ; Sun, 25 Feb 2024 13:04:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708895097; x=1709499897; 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=iH44O54D1Rgvm5xTG5kmDs8W5GncD7c1Iiq654IfniM=; b=PlFBJ3xCp4ZyFrXM7kUdBRdQtUPmWNI4igcW1kMW8QL9cJFkupCLnKUM+CJJxuGn4E jeJcLUBwHgOPBauhhPEs7OYG1IyBxYc4VcoXps+9ElHHZvNlP377RkzvnMJKn3hk9vc4 Icjs07KVTE43i+hPdY03rzcD5ZAQ35ko1Oquu2IHh6DBmmGOVtZN06BVoTwKDyMsof9n gTugwhUSn/RXYBmNFerKwRQJjVU3mUgiWFNMBeg6wbj9+OwPXic3vuWVQewDEaXo/Jn2 J79GHiI12mW5+3ERZ+yAyD4f+ogxm34dL6EGjZsnwEps/I4Aq3x+ILHvT32KUAp0cnUj HmBQ== X-Gm-Message-State: AOJu0YxBMxr+TPDr+3g4DLaxkw8LWqAWHGF2CoGDsdSKduQYvGLqTyMF y/32Ns8dbDhyRETIZnE1saeiAEZQGSHDtuzO3CqgGJvCCtsjp9PFUJXGLHDWUNmj9B0nmwC4GpN znMjqChcjFAG5Tor/zLCcCu8qrnsCWb4eZYI= X-Google-Smtp-Source: AGHT+IHYojdu4aHoV8ttfnAiKgZclrBUAOSdt6YHbFQrWPp8hZ8I7JrCT1DguLD/Uv6/IQvz9hYeEBOpC1gIeUnkQkM= X-Received: by 2002:a05:6602:4f59:b0:7c7:7c2d:2fd6 with SMTP id gm25-20020a0566024f5900b007c77c2d2fd6mr6589272iob.17.1708895096492; Sun, 25 Feb 2024 13:04:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Roland Mainz Date: Sun, 25 Feb 2024 22:04:29 +0100 Message-ID: Subject: Re: Will all SIDs fit into |SECURITY_MAX_SID_SIZE| bytes ? / was: 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.4 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 Sat, Feb 24, 2024 at 7:57=E2=80=AFPM Corinna Vinschen via Cygwin wrote: > > On Feb 24 15:38, Roland Mainz via Cygwin wrote: > > 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 whi= ch > > > > group is the new "current group" (e.g. which |TokenInformationClass= | > > > > should I use) ? > > > > > > PSID sidbuf =3D (PSID) alloca (SECURITY_MAX_SID_SIZE); > > [snip] > > > > Win32/NT API question: All known SIDs will fit into > > |SECURITY_MAX_SID_SIZE| bytes, right ? I'm asking because right now > > the ms-nfs41-client code assumes that all SIDs use a variable amount > > of memory, and we always have to ask the Win32/NT API about the number > > of bytes to allocate. If |SECURITY_MAX_SID_SIZE| is the global maximum > > limit for all Windows versions, then we could simplify the code a > > lot... > > Yes. ACLs are size restricted to 64K, though, but that shouldn't be > much of a problem usally. Erm... why ACLs? I was asking about the memory allocation size for an SID. Example: Right now our code uses two calls to |LookupAccountNameA()| for the conversion from a Windows account name to Windows SID. The first call gets the allocation size for a SID, our code then allocates that memory, and then does a second call to |LookupAccountNameA()| to fill that memory with that SID. If |SECURITY_MAX_SID_SIZE| (currently 68 bytes) is the maximum memory size a Windows syscall can return for a SID, then the code above could be simplified to a |sidmem =3D malloc(SECURITY_MAX_SID_SIZE)|+|LookupAccountNameA(..., sidmem, ...)|. The same could be done in many many other places, leading to a considerable reduction of Win32 system library calls. Question is whether the assumption about |SECURITY_MAX_SID_SIZE| is correct= ... ---- 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;)