s4-lsa: Cache sam.ldb handle in lsa_LookupSids3/LookupNames4
authorAndrew Bartlett <abartlet@samba.org>
Wed, 25 Aug 2021 00:03:08 +0000 (12:03 +1200)
committerJule Anger <janger@samba.org>
Wed, 8 Sep 2021 12:32:11 +0000 (12:32 +0000)
commit1252f2c170cd273d944f70b27584518b3bc8218d
treee4b8da20dfa8376105fccb47cf8dd102f6216e8b
parentbb825a909e91c1ba138490691258702744c60f6f
s4-lsa: Cache sam.ldb handle in lsa_LookupSids3/LookupNames4

Since 5c0345ea9bb34695dcd7be6c913748323bebe937 this
would not have been implicitly cached via the ldb_wrap
cache, due to the recording of the remote IP address
(which is a good thing).

This creates a more explicit and direct correct
cache on the connection.

The common code, including the SCHANNEL check is
placed into a helper function.

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

RN: Fix performance regression in lsa_LookupSids3/LookupNames4 since Samba 4.9 by using an explicit database handle cache

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Sep  5 03:19:26 UTC 2021 on sn-devel-184

(cherry picked from commit ae57d22e45b33537e9fca5969e9b68abd1ad633f)
source4/rpc_server/lsa/lsa_lookup.c