s3:winbindd: Improve performance of lookup_groupmem() in idmap_ad
authorPavel Filipenský <pfilipensky@samba.org>
Tue, 12 Mar 2024 12:20:24 +0000 (13:20 +0100)
committerPavel Filipensky <pfilipensky@samba.org>
Tue, 2 Apr 2024 12:25:31 +0000 (12:25 +0000)
commit5d475d26a3d545f04791a04e85a06b8b192e3fcf
treeb27fcf5128d2800e36fc3764d90f391ba0fe1a63
parenta485d9de2f2d6a9815dcac6addb988a8987e111c
s3:winbindd: Improve performance of lookup_groupmem() in idmap_ad

The LDAP query of lookup_groupmem() returns all group members from AD
even those with missing uidNumber.  Such group members are useless in
UNIX environment for idmap_ad backend since there is no uid mapping.

'test_user' is member of group "Domanin Users" with 200K members,
only 20K members have set uidNumber.

Without this fix:

$ time id test_user

real    1m5.946s
user    0m0.019s
sys     0m0.012s

With this fix:

$ time id test_user

real    0m3.544s
user    0m0.004s
sys     0m0.007s

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15605

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/winbindd_ads.c