delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/02/25/16:05:27

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D26C3858420
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1708895125;
bh=ss1bqXQ/jAt65lK6KAaIQD0GCzlPTnaAlBumw1QYZSQ=;
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=xAvgOnIci33sTCsX3thF8Iww5zKAf2ms7zuZmytWep8T3pVgLeHsBYs+dzOeJUE/w
GGIwWe1jGTEBZ4RCsLJOyBcgqq7DnN6eNu5FvwdSLEIxOID5r9t5om81GBctlx8pHv
Tf5HRjzblml2V8aX3MI0f2XnCCoFxVnowaw6K7Nk=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A4ED33858D39
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A4ED33858D39
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
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: <CAKAoaQnFxij4Np-jg+bOLEpiSziCfamFrJ2FR_JeO+Sv_Td2Kg AT mail DOT gmail DOT com>
<ZdecXZNUgQ3i0hYN AT calimero DOT vinschen DOT de>
<CAKAoaQk39bKbG0a_sZAR2KKz5f4U04xc=499YibfbdLesxC4Vg AT mail DOT gmail DOT com>
<Zdo8B-IhG_dYAjGo AT calimero DOT vinschen DOT de>
In-Reply-To: <Zdo8B-IhG_dYAjGo@calimero.vinschen.de>
Date: Sun, 25 Feb 2024 22:04:29 +0100
Message-ID: <CAKAoaQmL4wQ526dQ_-ASHCMum8L2sKiR_LnP-ba+R+39ZCMKVw@mail.gmail.com>
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 AT cygwin DOT com
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
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 41PL5RcD230601

On Sat, Feb 24, 2024 at 7:57 PM Corinna Vinschen via Cygwin
<cygwin AT cygwin DOT com> wrote:
>
> On Feb 24 15:38, Roland Mainz via Cygwin wrote:
> > 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);
> > [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 =
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
-- 
  __ .  . __
 (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