From b0fbda6b5f2ded024fa8a1b974ac6bd3e1edb0f9 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Wed, 22 Jul 2009 20:06:51 +0000
Subject: [PATCH] ITS#6220

---
 CHANGES                    | 1 +
 servers/slapd/connection.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGES b/CHANGES
index 9bf77436d3..ce827de527 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
 OpenLDAP 2.4 Change Log
 
 OpenLDAP 2.4.18 Engineering
+	Fixed slapd incorrectly applying writetimeout when not set (ITS#6220)
 
 OpenLDAP 2.4.17 Release (2009/07/13)
 	Fixed liblber to use ber_strnlen (ITS#6080)
diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c
index 05e8122c62..897a50c3bc 100644
--- a/servers/slapd/connection.c
+++ b/servers/slapd/connection.c
@@ -249,7 +249,7 @@ int connections_timeout_idle(time_t now)
 			i++;
 			continue;
 		}
-		if ( c->c_writewaiter ) {
+		if ( c->c_writewaiter && global_writetimeout ) {
 			writers = 1;
 			if( difftime( c->c_activitytime+global_writetimeout, now) < 0 ) {
 				/* close it */
@@ -260,7 +260,7 @@ int connections_timeout_idle(time_t now)
 		}
 	}
 	connection_done( c );
-	if ( !writers )
+	if ( old && !writers )
 		slapd_clr_writetime( old );
 
 	return i;
-- 
GitLab