s3: libads: ads_connect can be passed in an ADS_STRUCT with an existing IP address.
authorJeremy Allison <jra@samba.org>
Wed, 22 Jul 2020 22:35:43 +0000 (15:35 -0700)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 18 Aug 2020 08:25:39 +0000 (08:25 +0000)
commitc863cc2ba34025731a18ac735f714b5b888504da
tree32c9b9dabf620e9d0cffc23b6dcc573c861ee77e
parent6b47f3dbbcdb692e46237aa1d9aeeb944a78b308
s3: libads: ads_connect can be passed in an ADS_STRUCT with an existing IP address.

ads_connect can be passed in a reused ADS_STRUCT
with an existing ads->ldap.ss IP address that
is stored by going through ads_find_dc()
if ads->server.ldap_server was NULL.

If ads->server.ldap_server is still NULL but
the target address isn't a zero ip address,
then store it off before zeroing out ads->ldap
so we don't keep doing multiple calls to
ads_find_dc() in the reuse case.

If a caller wants a clean ADS_STRUCT they
will re-initialize by calling ads_init(), or
call ads_destroy() both of which ensures
ads->ldap.ss is a correctly zero'ed out IP address
by using ads_zero_ldap().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/libads/ldap.c