1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

s3:libads: Allocate ADS_STRUCT under a talloc context

The ads_destroy() function is now static and only called from the
ADS_STRUCT destructor.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Samuel Cabrero
2022-05-26 17:28:34 +02:00
committed by Jeremy Allison
parent 50934b85ff
commit d0dc0171ad
16 changed files with 94 additions and 153 deletions

View File

@ -424,7 +424,8 @@ WERROR NetGetJoinableOUs_l(struct libnetapi_ctx *ctx,
dc = strip_hostname(info->dc_unc);
ads = ads_init(info->domain_name,
ads = ads_init(tmp_ctx,
info->domain_name,
info->domain_name,
dc,
ADS_SASL_PLAIN);
@ -459,22 +460,18 @@ WERROR NetGetJoinableOUs_l(struct libnetapi_ctx *ctx,
ads_status = ads_connect_user_creds(ads);
if (!ADS_ERR_OK(ads_status)) {
ads_destroy(&ads);
ret = WERR_NERR_DEFAULTJOINREQUIRED;
goto out;
}
ads_status = ads_get_joinable_ous(ads, ctx, &p, &s);
if (!ADS_ERR_OK(ads_status)) {
ads_destroy(&ads);
ret = WERR_NERR_DEFAULTJOINREQUIRED;
goto out;
}
*r->out.ous = discard_const_p(const char *, p);
*r->out.ou_count = s;
ads_destroy(&ads);
ret = WERR_OK;
out:
TALLOC_FREE(tmp_ctx);