summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorSamuel Cabrero <scabrero@suse.de>2022-06-13 17:03:01 +0200
committerJeremy Allison <jra@samba.org>2022-06-27 15:50:30 +0000
commitca7ac79faefc92c5fb9cdc7acf14bd0d401b0d14 (patch)
treebe8f3e4f479ee5278ecabee3ea2d5682a7c92ea7 /source3/libads
parent633ccc55c0670cfe663ab7bf119feb8b22c92794 (diff)
downloadsamba-ca7ac79faefc92c5fb9cdc7acf14bd0d401b0d14.tar.gz
s3:libads: Allocate ads->auth.kdc_server under ADS_STRUCT talloc context
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/ads_struct.c1
-rwxr-xr-xsource3/libads/ldap.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index 00134d1a73c..e4739d7fd11 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -130,7 +130,6 @@ static void ads_destroy(ADS_STRUCT **ads)
#ifdef HAVE_LDAP
ads_disconnect(*ads);
#endif
- SAFE_FREE((*ads)->auth.kdc_server);
SAFE_FREE((*ads)->auth.ccache_name);
SAFE_FREE((*ads)->config.realm);
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 00a3c80c60f..5ac5b1b0e12 100755
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -733,7 +733,11 @@ got_connection:
if (!ads->auth.kdc_server) {
print_sockaddr(addr, sizeof(addr), &ads->ldap.ss);
- ads->auth.kdc_server = SMB_STRDUP(addr);
+ ads->auth.kdc_server = talloc_strdup(ads, addr);
+ if (ads->auth.kdc_server == NULL) {
+ status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+ goto out;
+ }
}
/* If the caller() requested no LDAP bind, then we are done */