From c90b20192dda446542a49578b9a74d8ee47f032c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 20 Feb 2024 23:54:25 +0100 Subject: [PATCH] Cygwin: getgrent/getpwent: avoid local enumeration on DCs ...if we're supposed to enumerate the AD accounts anyway. This avoids some useless duplication. Signed-off-by: Corinna Vinschen --- winsup/cygwin/passwd.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 0be8aa6b8..b8457a46f 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -385,6 +385,11 @@ pg_ent::getent (void) case from_local: if (from_db && nss_db_enum_local () + /* Domain controller? If so, sam and ad are one and the same + and "local ad" would list all domain accounts twice without + this test. */ + && (cygheap->dom.account_flat_name ()[0] != L'@' + || !nss_db_enum_primary ()) && (entry = enumerate_local ())) return entry; state = from_sam; -- 2.43.5