Fix bug #6098 - When the DNS server is invalid, the ads_find_dc() does not work corre...
authorYasuma Takeda <yasuma@osstech.co.jp>
Wed, 11 Feb 2009 22:23:29 +0000 (14:23 -0800)
committerKarolin Seeger <kseeger@samba.org>
Fri, 27 Mar 2009 12:06:43 +0000 (13:06 +0100)
1. If DNS server is invalid, the get_sorted_dc_list() is called with
realm(FQDN) and it fails.
2. On the next step, the get_sorted_dc_list() is called with realm(FQDN) again.

I think "again" is wrong place.
On the 2nd step, get_sorted_dc_list() should be called with realm(WORKGROUP).
(cherry picked from commit 2f3eafae83d036c5b35e5d7d11be6e29aaab7533)

source/libads/ldap.c

index 47b9f3e4d2c58ea8ccb1249dcb2bfd9bdf6e7c1c..9eae2d4f51395c5e390fe275789d685944fec0c8 100644 (file)
@@ -299,6 +299,8 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
        if (c_realm && *c_realm)
                got_realm = True;
 
+ again:
+
        /* we need to try once with the realm name and fallback to the
           netbios domain name if we fail (if netbios has not been disabled */
 
@@ -350,8 +352,6 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)
 
        sitename = sitename_fetch(realm);
 
- again:
-
        DEBUG(6,("ads_find_dc: (cldap) looking for %s '%s'\n",
                (got_realm ? "realm" : "domain"), realm));