libsmb/namequery: fallback to returning all dcs, when none is available in the reques...
authorStefan Metzmacher <metze@samba.org>
Mon, 27 Oct 2008 08:40:25 +0000 (09:40 +0100)
committerGünther Deschner <gd@samba.org>
Thu, 30 Oct 2008 13:52:26 +0000 (14:52 +0100)
It could happen that all dcs in a site are unavailable
(some sites have only one dc) and then we need to fallback
to get all dcs.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
source/libsmb/namequery.c

index b2a4156530c34eb062cdedd09530c99fdcf6bb37..0eb34e9079413deddf1ea765a111c179f66b9810 100644 (file)
@@ -1648,6 +1648,14 @@ NTSTATUS get_sorted_dc_list( const char *domain, const char *sitename, struct ip
        }
 
        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)) {
                return status; 
        }