]> 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 16:00:23 +0000 (16:00 +0000)
servers/lloadd/operation.c

index 4fdc190b9721e730578a9d22b0ff7a260336c6d1..907440439643160881c69c9af54256d87b76df4c 100644 (file)
@@ -589,19 +589,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);