[newlib-cygwin/main] Cygwin: getgrent/getpwent: avoid local enumeration on DCs
Corinna Vinschen
corinna@sourceware.org
Tue Feb 20 22:56:29 GMT 2024
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c90b20192dda446542a49578b9a74d8ee47f032c
commit c90b20192dda446542a49578b9a74d8ee47f032c
Author: Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Tue Feb 20 23:54:25 2024 +0100
Commit: Corinna Vinschen <corinna@vinschen.de>
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 <corinna@vinschen.de>
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;
More information about the Cygwin-cvs
mailing list