1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-26 01:49:31 +03:00

s3: libads: Where we implicitly zero out ads->ldap in ads_init() or ads_destroy() ensure we call ads_zero_ldap() after.

For ads_destroy(), this has a mode where the memory is not destroyed
but is being re-initialized. Horrid, but that's the way it works right
now.

This clears out the memory, but also leaves ads->ldap as a valid (zero) IPaddr.
Otherwise it's left by accident as AF_UNSPEC (0).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Jeremy Allison
2020-08-07 20:22:50 -07:00
committed by Andreas Schneider
parent 0535a265f9
commit 61895749f5

View File

@ -140,6 +140,9 @@ ADS_STRUCT *ads_init(const char *realm,
ads = SMB_XMALLOC_P(ADS_STRUCT);
ZERO_STRUCTP(ads);
#ifdef HAVE_LDAP
ads_zero_ldap(ads);
#endif
ads->server.realm = realm? SMB_STRDUP(realm) : NULL;
ads->server.workgroup = workgroup ? SMB_STRDUP(workgroup) : NULL;
@ -222,6 +225,9 @@ void ads_destroy(ADS_STRUCT **ads)
SAFE_FREE((*ads)->config.config_path);
ZERO_STRUCTP(*ads);
#ifdef HAVE_LDAP
ads_zero_ldap(*ads);
#endif
if ( is_mine )
SAFE_FREE(*ads);