X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34A2C3858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1707819688; bh=JsMVlS1sutuz9NWy80I+yGvi+0jYmJgAH5WhquJbd5Y=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=PchiNqXv0me9Q+780aAtgrUi3c9CihApH+h2D1LobJDTjSjjsk0EClepxPQBFUvay hIR8W9YKM6m/Xokzc7mvcq8i5qIBcRdK85nqd6e3Nn0qUuStfbvPOSwCPCkiFmLOrr Imbg0LRCEDgHPYEUmKtTZzZTLilIB9yMo6Dcs/cg= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C02163858414 Date: Tue, 13 Feb 2024 11:20:25 +0100 To: Dan Shelton Subject: Re: Win32 account SID lookup if user and group have the same name? Message-ID: Mail-Followup-To: Dan Shelton , cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen , cygwin AT cygwin DOT com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Feb 13 02:12, Dan Shelton via Cygwin wrote: > Hello! > > How can I get the SID for either user XOR group if both have the same > name? Remember Cygwin, as Unix and Linux, allow that a user "danfsh" > can have his own group "danfsh". That works fine there, but on Win32 > there is only LookupAccountSidA() which has no way to distinguish > whether you want a user SID or a group SID. User and group "danfsh" are NOT a user and a group. Rather, there is actually only one user account "danfsh" and Windows fills in your user token with the *same* SID as primary group. The weird thing in Windows is that it has no strict concept of groups. The user token contains primary and supplementary group info, but the OS can fill them with basically any SID it can lay its hands on. And at one point (I'm deliberately vague here since I don't know exactly when this occured), Microsoft started to fill in the primary group of some local account with the user SID, rather than with the "None"(*) group as is usually the default for local accounts. (*) That's the local domain SID with RID 513. The name of the group is actually localized. > How can I get the SID for group "danfsh", or the SID for user "danfsh"? It's the same SID and it's your user SID. There can't be a group with the same name as a user account in the same user DB. Each account in the local domain or in an AD domain has to have a unique account name. HTH, Corinna -- 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