]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:winbind: Pass a memory context to ads_cached_connection_connect()
authorSamuel Cabrero <scabrero@samba.org>
Wed, 25 May 2022 14:15:22 +0000 (16:15 +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/winbindd/winbindd_ads.c

index 8ffc7280c76e639531a57de85cc40abbe7fffa47..5be75d10451b14840c9493e50ed97ed7778b8bda 100644 (file)
@@ -91,13 +91,14 @@ static void ads_cached_connection_reuse(ADS_STRUCT **adsp)
  *
  * @return ADS_STATUS
  */
-static ADS_STATUS ads_cached_connection_connect(ADS_STRUCT **adsp,
-                                               const char *target_realm,
+static ADS_STATUS ads_cached_connection_connect(const char *target_realm,
                                                const char *target_dom_name,
                                                const char *ldap_server,
                                                char *password,
                                                char *auth_realm,
-                                               time_t renewable)
+                                               time_t renewable,
+                                               TALLOC_CTX *mem_ctx,
+                                               ADS_STRUCT **adsp)
 {
        ADS_STRUCT *ads;
        ADS_STATUS status;
@@ -251,13 +252,14 @@ ADS_STATUS ads_idmap_cached_connection(const char *dom_name,
        }
 
        status = ads_cached_connection_connect(
-               adsp,                   /* Returns ads struct. */
                wb_dom->alt_name,       /* realm to connect to. */
                dom_name,               /* 'workgroup' name for ads_init */
                ldap_server,            /* DNS name to connect to. */
                password,               /* password for auth realm. */
                realm,                  /* realm used for krb5 ticket. */
-               0);                     /* renewable ticket time. */
+               0,                      /* renewable ticket time. */
+               mem_ctx,                /* memory context for ads struct */
+               adsp);                  /* Returns ads struct. */
 
 out:
        TALLOC_FREE(tmp_ctx);
@@ -329,11 +331,13 @@ static ADS_STATUS ads_cached_connection(struct winbindd_domain *domain,
        }
 
        status = ads_cached_connection_connect(
-                                       &domain->backend_data.ads_conn,
                                        domain->alt_name,
                                        domain->name, NULL,
-                                       password, realm,
-                                       WINBINDD_PAM_AUTH_KRB5_RENEW_TIME);
+                                       password,
+                                       realm,
+                                       WINBINDD_PAM_AUTH_KRB5_RENEW_TIME,
+                                       domain,
+                                       &domain->backend_data.ads_conn);
        if (!ADS_ERR_OK(status)) {
                /* if we get ECONNREFUSED then it might be a NT4
                    server, fall back to MSRPC */