https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c90b20192dda446542a49578b9a74d8ee47f032c
commit c90b20192dda446542a49578b9a74d8ee47f032c Author: Corinna Vinschen <[email protected]> AuthorDate: Tue Feb 20 23:54:25 2024 +0100 Commit: Corinna Vinschen <[email protected]> CommitDate: Tue Feb 20 23:55:51 2024 +0100 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 <[email protected]> Diff: --- winsup/cygwin/passwd.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index 0be8aa6b8b0e..b8457a46f963 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;
