The Samba-Bugzilla – Bug 12548
ads_cached_connection_connect ends up calling get_dc_name twice causing additional work
Last modified: 2017-02-01 06:16:00 UTC
In ads_cached_connection_connect is calling get_dc_name line 131 and then through ads_connect get_dc_name is called one more time at line 491 (when ADS_AUTH_NO_BIND is not set in the flags) of hsource3/libads/ldap.c
On complicated setup get_dc_name can take lots of time (in tens of seconds) and calling twice in a row is a creating a performance penalty that could be improved.
Maybe in the ADS_STRUCT we can add a field to track when the last time get_dc_name was called and hopefully cache the results for sometime if it was successful.