public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/cygwin-3_5-branch] Cygwin: getgrent/getpwent: avoid local enumeration on DCs
Date: Tue, 27 Feb 2024 11:19:58 +0000 (GMT)	[thread overview]
Message-ID: <20240227111958.4F5D73858C36@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=69aba646123cef13a6aa9dbec175f1e22357df2e

commit 69aba646123cef13a6aa9dbec175f1e22357df2e
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Tue Feb 20 23:54:25 2024 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Feb 26 10:04:32 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;

                 reply	other threads:[~2024-02-27 11:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240227111958.4F5D73858C36@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).