[newlib-cygwin/main] Cygwin: uinfo: allow to override user account as primary group
Corinna Vinschen
corinna@sourceware.org
Mon Dec 22 11:43:55 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f9abafa6efbcaec665d42f85ea828e486bfc552f
commit f9abafa6efbcaec665d42f85ea828e486bfc552f
Author: Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Fri Dec 5 17:11:49 2025 +0100
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Dec 22 12:38:33 2025 +0100
Cygwin: uinfo: allow to override user account as primary group
Do not only allow to override the (localized) group "None" as primary
group, but also the user account. The user account is used as primary
group in the user token, if the user account is a Microsoft Account or
an AzureAD account.
Fixes: dc7b67316d01 ("Cygwin: uinfo: prefer token primary group")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/uinfo.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 8e9b9e07de9d..fb4618b8a19e 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -170,13 +170,17 @@ internal_getlogin (cygheap_user &user)
group of a local user ("None", localized), we have to find the SID
of that group and try to override the token primary group. Also
makes sure we're not on a domain controller, where account_sid ()
- == primary_sid (). */
+ == primary_sid ().
+ CV 2025-12-05: Microsoft Accounts as well as AzureAD accounts have
+ the primary group SID in their user token set to their own user SID.
+ Allow to override them as well. */
gsid = cygheap->dom.account_sid ();
gsid.append (DOMAIN_GROUP_RID_USERS);
if (!pgrp
|| (pwd->pw_gid != pgrp->gr_gid
&& cygheap->dom.account_sid () != cygheap->dom.primary_sid ()
- && RtlEqualSid (gsid, user.groups.pgsid)))
+ && (gsid == user.groups.pgsid
+ || user.sid () == user.groups.pgsid)))
{
if (gsid.getfromgr (grp = internal_getgrgid (pwd->pw_gid, &cldap)))
{
More information about the Cygwin-cvs
mailing list