summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-09-02 23:06:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:39:48 -0500
commitfea5d59b8411244b31df7980bdcdab9ed20dc712 (patch)
tree0adefcfccc5833651ef88f6cc115403de2a7cbb7 /source3/nsswitch
parent5e44fc4cd47108245c567b9e676a5d8c09787d96 (diff)
downloadsamba-fea5d59b8411244b31df7980bdcdab9ed20dc712.tar.gz
samba-fea5d59b8411244b31df7980bdcdab9ed20dc712.tar.bz2
samba-fea5d59b8411244b31df7980bdcdab9ed20dc712.zip
r18010: Ensure we don't timeout twice to the same
server in winbindd when it's down and listed in the -ve connection cache. Fix memory leak, reduce timeout for cldap calls - minimum 3 secs. Jeremy. (This used to be commit 10b32cb6de234fa17fdd691bb294864d4d40f782)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_cm.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index 6c35539e4d..b6a3b3ac05 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -791,17 +791,22 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
char *saf_servername = saf_fetch( domain->name );
int retries;
- if ((mem_ctx = talloc_init("cm_open_connection")) == NULL)
+ if ((mem_ctx = talloc_init("cm_open_connection")) == NULL) {
+ SAFE_FREE(saf_servername);
return NT_STATUS_NO_MEMORY;
+ }
/* we have to check the server affinity cache here since
later we selecte a DC based on response time and not preference */
- if ( saf_servername )
- {
+ /* Check the negative connection cache
+ before talking to it. It going down may have
+ triggered the reconnection. */
+
+ if ( saf_servername && NT_STATUS_IS_OK(check_negative_conn_cache( domain->name, saf_servername))) {
+
/* convert an ip address to a name */
- if ( is_ipaddress( saf_servername ) )
- {
+ if ( is_ipaddress( saf_servername ) ) {
fstring saf_name;
struct in_addr ip;
@@ -814,9 +819,7 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
domain->name, saf_servername,
NT_STATUS_UNSUCCESSFUL);
}
- }
- else
- {
+ } else {
fstrcpy( domain->dcname, saf_servername );
}