s3: libsmb/namequery: fallback to returning all dcs, when none is available in the...
[ab/samba.git/.git] / source3 / libsmb / namequery.c
index bcf849b795cc0aa44bfb45d3bc957ce5a034d8f6..87ed5af14c59b4ccad4cc7a99f1ccb7015891f34 100644 (file)
@@ -2098,6 +2098,15 @@ NTSTATUS get_sorted_dc_list( const char *domain,
 
        status = get_dc_list(domain, sitename, ip_list,
                        count, lookup_type, &ordered);
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NO_LOGON_SERVERS)
+           && sitename) {
+               DEBUG(3,("get_sorted_dc_list: no server for name %s available"
+                        " in site %s, fallback to all servers\n",
+                        domain, sitename));
+               status = get_dc_list(domain, NULL, ip_list,
+                                    count, lookup_type, &ordered);
+       }
+
        if (!NT_STATUS_IS_OK(status)) {
                SAFE_FREE(*ip_list);
                *count = 0;