]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9799 Drop a bind connection if there's a timeout
authorOndřej Kuzník <ondra@mistotebe.net>
Wed, 2 Mar 2022 11:44:01 +0000 (11:44 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 7 Jun 2022 15:58:05 +0000 (15:58 +0000)
servers/lloadd/operation.c

index 3414d1d6ea4f30ac46417b2eaddde83a29ca1997..0f875bb8ebfb63cf937e75ab934f03524d7c50b4 100644 (file)
@@ -616,19 +616,20 @@ connection_timeout( LloadConnection *upstream, void *arg )
                                                LDAP_ADMINLIMIT_EXCEEDED,
                 "upstream did not respond in time", 0 );
 
-        if ( rc == LDAP_SUCCESS ) {
+        if ( upstream->c_type != LLOAD_C_BIND && rc == LDAP_SUCCESS ) {
             rc = operation_send_abandon( op, upstream );
         }
         operation_unlink( op );
     }
 
-    /* TODO: if operation_send_abandon failed, we need to kill the upstream */
     if ( rc == LDAP_SUCCESS ) {
         connection_write_cb( -1, 0, upstream );
     }
 
     CONNECTION_LOCK(upstream);
-    if ( upstream->c_state == LLOAD_C_CLOSING && !upstream->c_ops ) {
+    /* ITS#9799: If a Bind timed out, connection is in an unknown state */
+    if ( upstream->c_type == LLOAD_C_BIND || rc != LDAP_SUCCESS ||
+            ( upstream->c_state == LLOAD_C_CLOSING && !upstream->c_ops ) ) {
         CONNECTION_DESTROY(upstream);
     } else {
         CONNECTION_UNLOCK(upstream);