summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-07-30 01:06:20 +0000
committerTim Potter <tpot@samba.org>2002-07-30 01:06:20 +0000
commit58fa0ad55a29c33828654291b6c8cac28561094a (patch)
tree8b5aa49d2eea32f7be0fd2a5c0ccf44b84254a28 /source3
parent362f534fa1152e9fc3d195bd1200b4c5d3e037e2 (diff)
downloadsamba-58fa0ad55a29c33828654291b6c8cac28561094a.tar.gz
samba-58fa0ad55a29c33828654291b6c8cac28561094a.tar.bz2
samba-58fa0ad55a29c33828654291b6c8cac28561094a.zip
Fixed for memory leak in connection caching code when a dc is
permanently down. Found by Dan Coppock. (This used to be commit 13c0cc830e3d787a0c3a1aedd47641597026541e)
Diffstat (limited to 'source3')
-rw-r--r--source3/nsswitch/winbindd_cm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index 674e71679c..02162bbd23 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -262,11 +262,23 @@ static struct failed_connection_cache *failed_connection_cache;
/* Add an entry to the failed conneciton cache */
-static void add_failed_connection_entry(struct winbindd_cm_conn *new_conn, NTSTATUS result) {
+static void add_failed_connection_entry(struct winbindd_cm_conn *new_conn,
+ NTSTATUS result)
+{
struct failed_connection_cache *fcc;
SMB_ASSERT(!NT_STATUS_IS_OK(result));
+ /* Check we already aren't in the cache */
+
+ for (fcc = failed_connection_cache; fcc; fcc = fcc->next) {
+ if (strequal(fcc->domain_name, new_conn->domain)) {
+ DEBUG(10, ("domain %s already tried and failed\n",
+ fcc->domain_name));
+ return;
+ }
+ }
+
/* Create negative lookup cache entry for this domain and controller */
if (!(fcc = (struct failed_connection_cache *)