diff options
author | Jeremy Allison <jra@samba.org> | 2007-01-17 18:25:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:14 -0500 |
commit | bfd099e148ed97394bc858e746a1a998a71ac43c (patch) | |
tree | e93e1c1227f117c5c532605bec396b543844b103 /source3/libads/ldap.c | |
parent | 90f59d441223ba9b32b0d788901c9de5cf4b3bc7 (diff) | |
download | samba-bfd099e148ed97394bc858e746a1a998a71ac43c.tar.gz samba-bfd099e148ed97394bc858e746a1a998a71ac43c.tar.bz2 samba-bfd099e148ed97394bc858e746a1a998a71ac43c.zip |
r20857: Silence gives assent :-). Checking in the fix for
site support in a network where many DC's are down.
I heard via Volker there is still a bug w.r.t the
wrong site being chosen with trusted domains but
we'll have to layer that fix on top of this.
Gd - complain if this doesn't work for you.
Jeremy.
(This used to be commit 97e248f89ac6548274f03f2ae7583a255da5ddb3)
Diffstat (limited to 'source3/libads/ldap.c')
-rw-r--r-- | source3/libads/ldap.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index c263e8e133..2ceae4d957 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -249,6 +249,7 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) pstring realm; BOOL got_realm = False; BOOL use_own_domain = False; + char *sitename = sitename_fetch(); NTSTATUS status = NT_STATUS_UNSUCCESSFUL; /* if the realm and workgroup are both empty, assume they are ours */ @@ -279,6 +280,7 @@ again: } if ( !c_realm || !*c_realm ) { + SAFE_FREE(sitename); DEBUG(0,("ads_find_dc: no realm or workgroup! Don't know what to do\n")); return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */ } @@ -289,7 +291,7 @@ again: DEBUG(6,("ads_find_dc: looking for %s '%s'\n", (got_realm ? "realm" : "domain"), realm)); - status = get_sorted_dc_list(realm, &ip_list, &count, got_realm); + status = get_sorted_dc_list(realm, sitename, &ip_list, &count, got_realm); if (!NT_STATUS_IS_OK(status)) { /* fall back to netbios if we can */ if ( got_realm && !lp_disable_netbios() ) { @@ -331,6 +333,7 @@ again: if ( ads_try_connect(ads, server) ) { SAFE_FREE(ip_list); + SAFE_FREE(sitename); return NT_STATUS_OK; } @@ -339,7 +342,19 @@ again: } SAFE_FREE(ip_list); - + + /* In case we failed to contact one of our closest DC on our site we + * need to try to find another DC, retry with a site-less SRV DNS query + * - Guenther */ + + if (sitename) { + DEBUG(1,("ads_find_dc: failed to find a valid DC on our site (%s), " + "trying to find another DC\n", sitename)); + SAFE_FREE(sitename); + namecache_delete(realm, 0x1C); + goto again; + } + return NT_STATUS_NO_LOGON_SERVERS; } |