]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:libsmb: ads_dc_name() doesn't need to retry if we found a DC in the closest site
authorStefan Metzmacher <metze@samba.org>
Thu, 26 Sep 2024 17:14:40 +0000 (19:14 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 1 Oct 2024 09:53:32 +0000 (09:53 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/libsmb/namequery_dc.c

index c61d14e25e138389651573ee3de6a1559b93bc5b..3a2f22129b848ea277249c71b9c3c386273f8b48 100644 (file)
@@ -60,7 +60,7 @@ static bool ads_dc_name(const char *domain,
        TALLOC_CTX *tmp_ctx = talloc_stackframe();
        bool ok = false;
        ADS_STRUCT *ads;
-       char *sitename;
+       const char *sitename;
        int i;
        char addr[INET6_ADDRSTRLEN];
 
@@ -94,6 +94,11 @@ static bool ads_dc_name(const char *domain,
                   has changed. If so, we need to re-do the DNS query
                   to ensure we only find servers in our site. */
 
+#ifdef HAVE_ADS
+               if (ads_closest_dc(ads)) {
+                       sitename = ads->config.client_site_name;
+               } else
+#endif
                if (stored_sitename_changed(realm, sitename)) {
                        sitename = sitename_fetch(tmp_ctx, realm);
                        TALLOC_FREE(ads);