]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: winbindd: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
authorJeremy Allison <jra@samba.org>
Wed, 26 Aug 2020 19:00:00 +0000 (12:00 -0700)
committerNoel Power <npower@samba.org>
Mon, 7 Sep 2020 13:23:41 +0000 (13:23 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/winbindd/winbindd_cm.c

index 854c227ad9d59327a847759babf3d5892cb35e12..00b0bd8a336f614ae84a6f5c1a122a47eb7517c8 100644 (file)
@@ -1536,8 +1536,8 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
        fstring dcname;
        struct  sockaddr_storage ss;
        struct  ip_service *ip_list = NULL;
-       int     iplist_size = 0;
-       int     i;
+       size_t     iplist_size = 0;
+       size_t     i;
        bool    is_our_domain;
        enum security_types sec = (enum security_types)lp_security();
 
@@ -1574,8 +1574,12 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                if (sitename) {
 
                        /* Do the site-specific AD dns lookup first. */
-                       get_sorted_dc_list(domain->alt_name, sitename, &ip_list,
-                              &iplist_size, True);
+                       (void)get_sorted_dc_list_talloc(mem_ctx,
+                                       domain->alt_name,
+                                       sitename,
+                                       &ip_list,
+                                       &iplist_size,
+                                       true);
 
                        /* Add ips to the DC array.  We don't look up the name
                           of the DC in this function, but we fill in the char*
@@ -1593,14 +1597,18 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                                                num_dcs);
                        }
 
-                       SAFE_FREE(ip_list);
+                       TALLOC_FREE(ip_list);
                        TALLOC_FREE(sitename);
                        iplist_size = 0;
                }
 
                /* Now we add DCs from the main AD DNS lookup. */
-               get_sorted_dc_list(domain->alt_name, NULL, &ip_list,
-                       &iplist_size, True);
+               (void)get_sorted_dc_list_talloc(mem_ctx,
+                               domain->alt_name,
+                               NULL,
+                               &ip_list,
+                               &iplist_size,
+                               true);
 
                for ( i=0; i<iplist_size; i++ ) {
                        char addr[INET6_ADDRSTRLEN];
@@ -1614,19 +1622,27 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                                        num_dcs);
                }
 
-               SAFE_FREE(ip_list);
+               TALLOC_FREE(ip_list);
                iplist_size = 0;
         }
 
        /* Try standard netbios queries if no ADS and fall back to DNS queries
         * if alt_name is available */
        if (*num_dcs == 0) {
-               get_sorted_dc_list(domain->name, NULL, &ip_list, &iplist_size,
-                      false);
+               (void)get_sorted_dc_list_talloc(mem_ctx,
+                                       domain->name,
+                                       NULL,
+                                       &ip_list,
+                                       &iplist_size,
+                                       false);
                if (iplist_size == 0) {
                        if (domain->alt_name != NULL) {
-                               get_sorted_dc_list(domain->alt_name, NULL, &ip_list,
-                                      &iplist_size, true);
+                               (void)get_sorted_dc_list_talloc(mem_ctx,
+                                               domain->alt_name,
+                                               NULL,
+                                               &ip_list,
+                                               &iplist_size,
+                                               true);
                        }
                }
 
@@ -1642,7 +1658,7 @@ static bool get_dcs(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                                        num_dcs);
                }
 
-               SAFE_FREE(ip_list);
+               TALLOC_FREE(ip_list);
                iplist_size = 0;
        }