]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:net: Pass a memory context to ads_startup_nobind()
authorSamuel Cabrero <scabrero@samba.org>
Wed, 25 May 2022 15:09:51 +0000 (17:09 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 27 Jun 2022 15:50:29 +0000 (15:50 +0000)
The ads struct will be allocated under this context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/utils/net_ads.c
source3/utils/net_proto.h

index 755f81d78b1bb652773988e03b899715581c1307..4f3ebeaa9ffec2cdc278537fd17534347ad4d651 100644 (file)
@@ -429,7 +429,7 @@ static int net_ads_lookup(struct net_context *c, int argc, const char **argv)
                return 0;
        }
 
-       status = ads_startup_nobind(c, false, &ads);
+       status = ads_startup_nobind(c, false, tmp_ctx, &ads);
        if (!ADS_ERR_OK(status)) {
                d_fprintf(stderr, _("Didn't find the cldap server!\n"));
                goto out;
@@ -555,7 +555,7 @@ static int net_ads_info(struct net_context *c, int argc, const char **argv)
                return 0;
        }
 
-       status = ads_startup_nobind(c, false, &ads);
+       status = ads_startup_nobind(c, false, tmp_ctx, &ads);
        if (!ADS_ERR_OK(status)) {
                d_fprintf(stderr, _("Didn't find the ldap server!\n"));
                goto out;
@@ -745,7 +745,10 @@ ADS_STATUS ads_startup(struct net_context *c, bool only_own_domain, ADS_STRUCT *
        return ads_startup_int(c, only_own_domain, 0, ads);
 }
 
-ADS_STATUS ads_startup_nobind(struct net_context *c, bool only_own_domain, ADS_STRUCT **ads)
+ADS_STATUS ads_startup_nobind(struct net_context *c,
+                             bool only_own_domain,
+                             TALLOC_CTX *mem_ctx,
+                             ADS_STRUCT **ads)
 {
        return ads_startup_int(c, only_own_domain, ADS_AUTH_NO_BIND, ads);
 }
@@ -808,7 +811,7 @@ static int net_ads_workgroup(struct net_context *c, int argc, const char **argv)
                return 0;
        }
 
-       status = ads_startup_nobind(c, false, &ads);
+       status = ads_startup_nobind(c, false, tmp_ctx, &ads);
        if (!ADS_ERR_OK(status)) {
                d_fprintf(stderr, _("Didn't find the cldap server!\n"));
                goto out;
index b6ff639a0941a497a6b6c97796abe0ecae9a23da..3e4f1639bbdbfb4da21323afeaf40ccdfd2425e2 100644 (file)
@@ -34,7 +34,10 @@ enum netr_SchannelType get_sec_channel_type(const char *param);
 /* The following definitions come from utils/net_ads.c  */
 struct ads_struct;
 ADS_STATUS ads_startup(struct net_context *c, bool only_own_domain, struct ads_struct **ads);
-ADS_STATUS ads_startup_nobind(struct net_context *c, bool only_own_domain, struct ads_struct **ads);
+ADS_STATUS ads_startup_nobind(struct net_context *c,
+                             bool only_own_domain,
+                             TALLOC_CTX *mem_ctx,
+                             struct ads_struct **ads);
 int net_ads_check_our_domain(struct net_context *c);
 int net_ads_check(struct net_context *c);
 int net_ads_user(struct net_context *c, int argc, const char **argv);