From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 662F5385842C; Mon, 11 Mar 2024 16:22:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 662F5385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710174127; bh=IldUMoDc9dJ6kYJEJlBl6MC9056NWxyKVXb+8UijL6M=; h=From:To:Subject:Date:From; b=GKBU+Joa00Ev6inD9K1NcHZ7QP/jenWkjPw0tYTdCOjlpbPgHoQb+Ha83EoCztmZ9 EbiDDrQ+GB2UviDu3uMfdsmZ3+1Ttzcwe0/VIEbGjABbjIkl4pm4nrWJ1VChN7hrdZ iPlONTIryfwgqA8YcWE/tUUJAjBQjH1ukEKe+vvc= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: getgrent: don't skip SAM-only builtin-accounts X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 3b97a5ec67a5a52c130158bb143949cd842de305 X-Git-Newrev: 5f586adc634588895b5c4afa24f819859aee50d7 Message-Id: <20240311162207.662F5385842C@sourceware.org> Date: Mon, 11 Mar 2024 16:22:07 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D5f586adc634= 588895b5c4afa24f819859aee50d7 commit 5f586adc634588895b5c4afa24f819859aee50d7 Author: Corinna Vinschen AuthorDate: Mon Mar 11 12:38:39 2024 +0100 Commit: Corinna Vinschen CommitDate: Mon Mar 11 12:46:50 2024 +0100 Cygwin: getgrent: don't skip SAM-only builtin-accounts =20 Since commit 15e82eef3a40b ("Cygwin: getgrent: fix local SAM enumeration on domain member machines") we skip enumerating local BUILTIN accounts if we also enumerate AD. However, there are two local accounts which are only available in local SAM, not in AD. Don't skip enumerating those. =20 Fixes: 15e82eef3a40b ("Cygwin: getgrent: fix local SAM enumeration on d= omain member machines") Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/grp.cc | 11 ++++++++--- winsup/cygwin/local_includes/winlean.h | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 77cf6a72c69f..5f80d7aa7ec5 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -428,10 +428,15 @@ gr_ent::enumerate_local () ((PLOCALGROUP_INFO_0) buf)[cnt++].lgrpi0_name, sid, &slen, dom, &dlen, &acc_type)) continue; - if (sid_id_auth (sid) =3D=3D 5 /* SECURITY_NT_AUTHORITY */ + /* Skip builtin groups if we're enumerating AD as well to avoid + duplication. Don't skip "Power Users" and "Device Owners" + accounts, they don't show up in AD enumeration. */ + if (cygheap->dom.member_machine () + && nss_db_enum_primary () + && sid_id_auth (sid) =3D=3D 5 /* SECURITY_NT_AUTHORITY */ && sid_sub_auth (sid, 0) =3D=3D SECURITY_BUILTIN_DOMAIN_RID - && cygheap->dom.member_machine () - && nss_db_enum_primary ()) + && sid_sub_auth (sid, 1) !=3D DOMAIN_ALIAS_RID_POWER_USERS + && sid_sub_auth (sid, 1) !=3D DOMAIN_ALIAS_RID_DEVICE_OWNERS) continue; fetch_user_arg_t arg; arg.type =3D SID_arg; diff --git a/winsup/cygwin/local_includes/winlean.h b/winsup/cygwin/local_i= ncludes/winlean.h index 947109bdeee4..5bf1be262a00 100644 --- a/winsup/cygwin/local_includes/winlean.h +++ b/winsup/cygwin/local_includes/winlean.h @@ -104,6 +104,10 @@ details. */ #define FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS 0x00400000 #endif =20 +#ifndef DOMAIN_ALIAS_RID_DEVICE_OWNERS +#define DOMAIN_ALIAS_RID_DEVICE_OWNERS (__MSABI_LONG(0x00000247)) +#endif + /* So-called "Microsoft Account" SIDs (S-1-11-...) have a netbios domain n= ame "MicrosoftAccounts". The new "Application Container SIDs" (S-1-15-...) have a netbios domain name "APPLICATION PACKAGE AUTHORITY"