mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3:libads: Allocate ads->server.workgroup 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:
parent
cdef601150
commit
5ec9b8ef31
@ -130,7 +130,6 @@ static void ads_destroy(ADS_STRUCT **ads)
|
||||
#ifdef HAVE_LDAP
|
||||
ads_disconnect(*ads);
|
||||
#endif
|
||||
SAFE_FREE((*ads)->server.workgroup);
|
||||
SAFE_FREE((*ads)->server.ldap_server);
|
||||
|
||||
SAFE_FREE((*ads)->auth.realm);
|
||||
@ -184,7 +183,13 @@ ADS_STRUCT *ads_init(TALLOC_CTX *mem_ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ads->server.workgroup = workgroup ? SMB_STRDUP(workgroup) : NULL;
|
||||
ads->server.workgroup = talloc_strdup(ads, workgroup);
|
||||
if (workgroup != NULL && ads->server.workgroup == NULL) {
|
||||
DBG_WARNING("Out of memory\n");
|
||||
TALLOC_FREE(ads);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ads->server.ldap_server = ldap_server? SMB_STRDUP(ldap_server) : NULL;
|
||||
|
||||
wrap_flags = lp_client_ldap_sasl_wrapping();
|
||||
|
@ -296,7 +296,7 @@ static bool ads_try_connect(ADS_STRUCT *ads, bool gc,
|
||||
SAFE_FREE(ads->config.ldap_server_name);
|
||||
SAFE_FREE(ads->config.server_site_name);
|
||||
SAFE_FREE(ads->config.client_site_name);
|
||||
SAFE_FREE(ads->server.workgroup);
|
||||
TALLOC_FREE(ads->server.workgroup);
|
||||
|
||||
if (!check_cldap_reply_required_flags(cldap_reply.server_type,
|
||||
ads->config.flags)) {
|
||||
@ -320,7 +320,13 @@ static bool ads_try_connect(ADS_STRUCT *ads, bool gc,
|
||||
ads->config.client_site_name =
|
||||
SMB_STRDUP(cldap_reply.client_site);
|
||||
}
|
||||
ads->server.workgroup = SMB_STRDUP(cldap_reply.domain_name);
|
||||
|
||||
ads->server.workgroup = talloc_strdup(ads, cldap_reply.domain_name);
|
||||
if (ads->server.workgroup == NULL) {
|
||||
DBG_WARNING("Out of memory\n");
|
||||
ret = false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ads->ldap.port = gc ? LDAP_GC_PORT : LDAP_PORT;
|
||||
ads->ldap.ss = *ss;
|
||||
|
Loading…
Reference in New Issue
Block a user