summaryrefslogtreecommitdiffstats
path: root/source/nsswitch
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
commit13c0cc830e3d787a0c3a1aedd47641597026541e (patch)
tree3d4c111317e24d1a67ad45831b85388982349c6d /source/nsswitch
parent33bd7214736dafd5927d63af5f8510646b81e7df (diff)
downloadsamba-13c0cc830e3d787a0c3a1aedd47641597026541e.tar.gz
samba-13c0cc830e3d787a0c3a1aedd47641597026541e.tar.xz
samba-13c0cc830e3d787a0c3a1aedd47641597026541e.zip
Fixed for memory leak in connection caching code when a dc is
permanently down. Found by Dan Coppock.
Diffstat (limited to 'source/nsswitch')
-rw-r--r--source/nsswitch/winbindd_cm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/nsswitch/winbindd_cm.c b/source/nsswitch/winbindd_cm.c
index 674e71679c1..02162bbd23f 100644
--- a/source/nsswitch/winbindd_cm.c
+++ b/source/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 *)