Package not found: openSUSE:Containers:Tumbleweed/tumbleweed-busybox-image.20240513233117

File 0238-ITS-9468-do-not-arm-expire-timer-for-connections-tha.patch of Package openldap2.29143

From bc05e285b3c647437606887c4810c0b1a4d3f308 Mon Sep 17 00:00:00 2001
From: Tero Saarni <tero.saarni@est.tech>
Date: Thu, 13 May 2021 21:13:08 +0300
Subject: [PATCH 238/238] ITS#9468 do not arm expire timer for connections that
 are already tainted

---
 servers/slapd/back-ldap/bind.c | 58 +++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 26 deletions(-)

diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c
index 0ec435c8c..37b07cf63 100644
--- a/servers/slapd/back-ldap/bind.c
+++ b/servers/slapd/back-ldap/bind.c
@@ -3121,6 +3121,38 @@ ldap_back_conn_prune( ldapinfo_t *li )
 
 		while ( lc ) {
 			ldapconn_t *next = LDAP_TAILQ_NEXT( lc, lc_q );
+
+			if ( !LDAP_BACK_CONN_TAINTED( lc ) ) {
+				time_t conn_expires = ldap_back_conn_expire_time( li, lc );
+
+				if ( now >= conn_expires ) {
+					if ( lc->lc_refcnt == 0 ) {
+						Debug( LDAP_DEBUG_TRACE,
+							"ldap_back_conn_prune: closing expired connection lc=%p\n",
+							lc, 0, 0 );
+						ldap_back_freeconn( li, lc, 0 );
+					} else {
+						Debug( LDAP_DEBUG_TRACE,
+							"ldap_back_conn_prune: tainting expired connection lc=%p\n",
+							lc, 0, 0 );
+						LDAP_BACK_CONN_TAINTED_SET( lc );
+					}
+				} else if ( next_timeout == -1 || conn_expires < next_timeout ) {
+					/* next_timeout was not yet initialized or current connection expires sooner */
+					next_timeout = conn_expires;
+				}
+			}
+
+			lc = next;
+		}
+	}
+
+	edge = tavl_end( li->li_conninfo.lai_tree, TAVL_DIR_LEFT );
+	while ( edge ) {
+		TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
+		ldapconn_t *lc = (ldapconn_t *)edge->avl_data;
+
+		if ( !LDAP_BACK_CONN_TAINTED( lc ) ) {
 			time_t conn_expires = ldap_back_conn_expire_time( li, lc );
 
 			if ( now >= conn_expires ) {
@@ -3136,34 +3168,8 @@ ldap_back_conn_prune( ldapinfo_t *li )
 					LDAP_BACK_CONN_TAINTED_SET( lc );
 				}
 			} else if ( next_timeout == -1 || conn_expires < next_timeout ) {
-				/* next_timeout was not yet initialized or current connection expires sooner */
 				next_timeout = conn_expires;
 			}
-
-			lc = next;
-		}
-	}
-
-	edge = tavl_end( li->li_conninfo.lai_tree, TAVL_DIR_LEFT );
-	while ( edge ) {
-		TAvlnode *next = tavl_next( edge, TAVL_DIR_RIGHT );
-		ldapconn_t *lc = (ldapconn_t *)edge->avl_data;
-		time_t conn_expires = ldap_back_conn_expire_time( li, lc );
-
-		if ( now >= conn_expires ) {
-			if ( lc->lc_refcnt == 0 ) {
-				Debug( LDAP_DEBUG_TRACE,
-					"ldap_back_conn_prune: closing expired connection lc=%p\n",
-					lc, 0, 0 );
-				ldap_back_freeconn( li, lc, 0 );
-			} else {
-				Debug( LDAP_DEBUG_TRACE,
-					"ldap_back_conn_prune: tainting expired connection lc=%p\n",
-					lc, 0, 0 );
-				LDAP_BACK_CONN_TAINTED_SET( lc );
-			}
-		} else if ( next_timeout == -1 || conn_expires < next_timeout ) {
-			next_timeout = conn_expires;
 		}
 
 		edge = next;
-- 
2.32.0

openSUSE Build Service is sponsored by