public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: getgrent/getpwent: avoid local enumeration on DCs
@ 2024-02-20 22:56 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2024-02-20 22:56 UTC (permalink / raw)
  To: cygwin-cvs

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-20 22:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 22:56 [newlib-cygwin/main] Cygwin: getgrent/getpwent: avoid local enumeration on DCs Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).