summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorSamuel Cabrero <scabrero@suse.de>2022-06-13 16:53:32 +0200
committerJeremy Allison <jra@samba.org>2022-06-27 15:50:30 +0000
commit633ccc55c0670cfe663ab7bf119feb8b22c92794 (patch)
tree60ec2420ece0d2fa60734f628e4724deec31a093 /source3/libnet
parentd64335eaef5ad690ea923a8e6656b9185a54d9fa (diff)
downloadsamba-633ccc55c0670cfe663ab7bf119feb8b22c92794.tar.gz
s3:libads: Allocate ads->auth.user_name under ADS_STRUCT talloc context
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_join.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 0ec5ff4c1d8..2c5e4631e50 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -171,8 +171,12 @@ static ADS_STATUS libnet_connect_ads(const char *dns_domain_name,
}
if (user_name) {
- SAFE_FREE(my_ads->auth.user_name);
- my_ads->auth.user_name = SMB_STRDUP(user_name);
+ TALLOC_FREE(my_ads->auth.user_name);
+ my_ads->auth.user_name = talloc_strdup(my_ads, user_name);
+ if (my_ads->auth.user_name == NULL) {
+ status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
+ goto out;
+ }
if ((cp = strchr_m(my_ads->auth.user_name, '@'))!=0) {
*cp++ = '\0';
TALLOC_FREE(my_ads->auth.realm);