From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 4F5D73858C36; Tue, 27 Feb 2024 11:19:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F5D73858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709032798; bh=VInrjWCGBqhmnmK7UpnGQgij/8dJIwro22aWDQyso7s=; h=From:To:Subject:Date:From; b=omXrW3Qr22en8DeOtLrWDuNSwwkIKij0VeLrKDC6tKZ1KE7eUa71qZRCzD+TOpOW2 r0459MS1tUa0D7Q+QX97PLYB81EavXmgSjlj+HMLzvxESAuJ+5SlbEQCDnHfZDruv/ IopaIi+7fPldaukr3BmZzIHE/R8HKTB2JcJTwG7M= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_5-branch] Cygwin: getgrent/getpwent: avoid local enumeration on DCs X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/cygwin-3_5-branch X-Git-Oldrev: 50240f20ecfc7bc7a2961c25f96f5b9345c984ac X-Git-Newrev: 69aba646123cef13a6aa9dbec175f1e22357df2e Message-Id: <20240227111958.4F5D73858C36@sourceware.org> Date: Tue, 27 Feb 2024 11:19:58 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D69aba646123= cef13a6aa9dbec175f1e22357df2e commit 69aba646123cef13a6aa9dbec175f1e22357df2e Author: Corinna Vinschen AuthorDate: Tue Feb 20 23:54:25 2024 +0100 Commit: Corinna Vinschen CommitDate: Mon Feb 26 10:04:32 2024 +0100 Cygwin: getgrent/getpwent: avoid local enumeration on DCs =20 ...if we're supposed to enumerate the AD accounts anyway. This avoids some useless duplication. =20 Signed-off-by: Corinna Vinschen 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] !=3D L'@' + || !nss_db_enum_primary ()) && (entry =3D enumerate_local ())) return entry; state =3D from_sam;