diff options
author | Jeremy Allison <jra@samba.org> | 2006-09-03 03:46:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:39:48 -0500 |
commit | 98cfbd3ccfb3d2255a65289410e5e358ff3d1a64 (patch) | |
tree | 8fca683ce2de27756122271f973477a8db9b09fe /source3/nsswitch | |
parent | 6fc90da054e06ac4f9db673e237faed6ccc88207 (diff) | |
download | samba-98cfbd3ccfb3d2255a65289410e5e358ff3d1a64.tar.gz samba-98cfbd3ccfb3d2255a65289410e5e358ff3d1a64.tar.bz2 samba-98cfbd3ccfb3d2255a65289410e5e358ff3d1a64.zip |
r18015: Try and detect network failures immediately in
set_dc_type_and_flags().
Fix problem when DC is down in ads_connect, where
we fall back to NetBIOS and try exactly the same
IP addresses we just put in the negative connection
cache.... We can never succeed, so don't try lookups
a second time.
Jeremy.
(This used to be commit 2d28f3e94a1a87bc9e9ed6630ef48b1ce17022e8)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/winbindd_cm.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index b6a3b3ac05..ce4e3cae18 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -594,7 +594,7 @@ static BOOL dcip_to_name( const char *domainname, const char *realm, /* For active directory servers, try to get the ldap server name. None of these failures should be considered critical for now */ - if ( lp_security() == SEC_ADS ) { + if (lp_security() == SEC_ADS) { ADS_STRUCT *ads; ads = ads_init(realm, domainname, NULL); @@ -976,10 +976,11 @@ void set_dc_type_and_flags( struct winbindd_domain *domain ) TALLOC_CTX *mem_ctx = NULL; struct rpc_pipe_client *cli; POLICY_HND pol; - + char *domain_name = NULL; char *dns_name = NULL; DOM_SID *dom_sid = NULL; + int try_count = 0; ZERO_STRUCT( ctr ); @@ -991,8 +992,10 @@ void set_dc_type_and_flags( struct winbindd_domain *domain ) return; } + try_again: + result = init_dc_connection(domain); - if (!NT_STATUS_IS_OK(result)) { + if (!NT_STATUS_IS_OK(result) || try_count > 2) { DEBUG(5, ("set_dc_type_and_flags: Could not open a connection " "to %s: (%s)\n", domain->name, nt_errstr(result))); domain->initialized = True; @@ -1007,7 +1010,9 @@ void set_dc_type_and_flags( struct winbindd_domain *domain ) "PI_LSARPC_DS on domain %s: (%s)\n", domain->name, nt_errstr(result))); domain->initialized = True; - return; + /* We want to detect network failures asap to try another dc. */ + try_count++; + goto try_again; } result = rpccli_ds_getprimarydominfo(cli, cli->cli->mem_ctx, @@ -1028,7 +1033,9 @@ void set_dc_type_and_flags( struct winbindd_domain *domain ) if (cli == NULL) { domain->initialized = True; - return; + /* We want to detect network failures asap to try another dc. */ + try_count++; + goto try_again; } mem_ctx = talloc_init("set_dc_type_and_flags on domain %s\n", |