X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A04873858D28
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1696350896;
	bh=qgLNASJ6lXhNHM5ZqUcb1+vxgXMcLCc2Q61ZuVAKV9c=;
	h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=n4KFc9WALSWiyYk31I66cbM36S2dqRIz7kGfEvUb/3a8Yyve0ctUDfC6fGRbj6eIk
	 T882WAZy4vH/tNyr+v5MBS9Hx+mPBmVZQ3ibwy6obGz+2diXhmf4LIXy1hS4IkFxgJ
	 JEtuCz5vCen0JGRL76EUzOl8g873uxiExR2FnwaM=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 381113858D20
X-Authority-Analysis: v=2.4 cv=JbqvEGGV c=1 sm=1 tr=0 ts=651c4286
 a=DxHlV3/gbUaP7LOF0QAmaA==:117 a=DxHlV3/gbUaP7LOF0QAmaA==:17
 a=IkcTkHD0fZMA:10 a=uPZiAMpXAAAA:8 a=yMhMjlubAAAA:8 a=78rZs-aVeecKEWsD2eoA:9
 a=QEXdDO2ut3YA:10
Message-ID: <81cf5ae8-dd74-9628-9cd0-e3a82bfed613@Shaw.ca>
Date: Tue, 3 Oct 2023 10:34:13 -0600
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
 Thunderbird/102.15.1
Subject: Re: ConvertStringSidToSidA("S-1-22-1-1", &sid) fails with invalid sid
 for Unix_User+1
Content-Language: en-CA
To: cygwin@cygwin.com
References: <CALXu0UfW04-2qBDHCjPqU_VCNZyAGUspHcYgbuYL3Ky9SvRs+g@mail.gmail.com>
Organization: Inglis
In-Reply-To: <CALXu0UfW04-2qBDHCjPqU_VCNZyAGUspHcYgbuYL3Ky9SvRs+g@mail.gmail.com>
X-CMAE-Envelope: MS4xfLUdzrrDqqjMrm0Yj1gMzseSzw6Zhrcbld2NQfDQfrbvf/8jhuXWeAi0yCUsYV7GcG1WLUStKopqZzDh/Ju66mnE+8a6VU9rbkN4g2rfhVoelUGhd6sW
 NBCOwTtvGWSvTjvDMY1tFLaDbVkxuWHj6Gctz56Kc755rbEUKBkVREcBiGsPk1FePOmHoXgDIqmjYcBMIzU+bU5KBeqosSJJgQLun/CpDo91AdWrwQt0UcsA
X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED,
 DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, NICE_REPLY_A,
 RCVD_IN_DNSWL_LOW, 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
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Brian Inglis <Brian.Inglis@Shaw.ca>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

On 2023-10-03 09:42, Cedric Blancher via Cygwin wrote:
> I tried a simple three line hello world program, which tries to get
> the SID for Unix_User+1:
> bash -c 'getent passwd "Unix_User+1"'
> Unix_User+1:*:4278190081:4278190081:U-Unix_User\1,S-1-22-1-1:/:/sbin/nologin
> 
> But putting "S-1-22-1-1" into ConvertStringSidToSidA("S-1-22-1-1",
> &sid) fails with ERROR_INVALID_SID on Cygwin.
> 
> Why? I thought SMB had "S-1-22-1-*" reserved for its usage, and Cygwin
> uses Unix_User+1 in it's output.
> How can I get ConvertStringSidToSidA("S-1-22-1-1", &sid) working in my program?

Cygwin's focus is on using POSIX tools to do useful work on Windows hosts, 
avoiding the native APIs and tools because of their innumerable shortcomings.

You should ask these Windows queations on more appropriate forums, such as MS, 
Mingw64, Msys2, or SO:

https://stackoverflow.com/questions/54894967/why-does-convertstringsidtosid-fail-to-convert-a-string-sid

after carefully reading the MS docs:

https://learn.microsoft.com/en-us/windows/win32/api/sddl/nf-sddl-convertstringsidtosida

and use a (re-/)search tool to find this basic background information and 
answers to queries, not ask on Cygwin lists.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

Today is Tuesday, September 10990, 1993, the September that never ends

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