1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:libads: Allocate ads->config.server_site_name under ADS_STRUCT talloc context

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Samuel Cabrero 2022-06-15 12:09:21 +02:00 committed by Jeremy Allison
parent dcf6578dff
commit 40cd92040b
2 changed files with 8 additions and 3 deletions

View File

@ -153,7 +153,6 @@ static void ads_destroy(ADS_STRUCT **ads)
#ifdef HAVE_LDAP #ifdef HAVE_LDAP
ads_disconnect(*ads); ads_disconnect(*ads);
#endif #endif
SAFE_FREE((*ads)->config.server_site_name);
SAFE_FREE((*ads)->config.client_site_name); SAFE_FREE((*ads)->config.client_site_name);
SAFE_FREE((*ads)->config.schema_path); SAFE_FREE((*ads)->config.schema_path);
SAFE_FREE((*ads)->config.config_path); SAFE_FREE((*ads)->config.config_path);

View File

@ -295,7 +295,7 @@ static bool ads_try_connect(ADS_STRUCT *ads, bool gc,
TALLOC_FREE(ads->config.realm); TALLOC_FREE(ads->config.realm);
TALLOC_FREE(ads->config.bind_path); TALLOC_FREE(ads->config.bind_path);
TALLOC_FREE(ads->config.ldap_server_name); TALLOC_FREE(ads->config.ldap_server_name);
SAFE_FREE(ads->config.server_site_name); TALLOC_FREE(ads->config.server_site_name);
SAFE_FREE(ads->config.client_site_name); SAFE_FREE(ads->config.client_site_name);
TALLOC_FREE(ads->server.workgroup); TALLOC_FREE(ads->server.workgroup);
@ -332,8 +332,14 @@ static bool ads_try_connect(ADS_STRUCT *ads, bool gc,
if (*cldap_reply.server_site) { if (*cldap_reply.server_site) {
ads->config.server_site_name = ads->config.server_site_name =
SMB_STRDUP(cldap_reply.server_site); talloc_strdup(ads, cldap_reply.server_site);
if (ads->config.server_site_name == NULL) {
DBG_WARNING("Out of memory\n");
ret = false;
goto out;
}
} }
if (*cldap_reply.client_site) { if (*cldap_reply.client_site) {
ads->config.client_site_name = ads->config.client_site_name =
SMB_STRDUP(cldap_reply.client_site); SMB_STRDUP(cldap_reply.client_site);