]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Operation abandon related fixes
authorOndřej Kuzník <ondra@mistotebe.net>
Wed, 17 Jan 2018 15:27:14 +0000 (15:27 +0000)
committerOndřej Kuzník <okuznik@symas.com>
Tue, 17 Nov 2020 17:58:14 +0000 (17:58 +0000)
servers/lloadd/client.c
servers/lloadd/operation.c

index 122a26d432a0401e8a2c97259fca645114d7d06b..ba20bc975643e4eec19da77feb85d49fdbd3c4ee 100644 (file)
@@ -71,6 +71,8 @@ request_abandon( LloadConnection *c, LloadOperation *op )
         c->c_state = LLOAD_C_READY;
     }
 
+    /* operation_abandon requires a reference since it is passed with c unlocked */
+    request->o_client_refcnt++;
     CONNECTION_UNLOCK_INCREF(c);
     operation_abandon( request );
     CONNECTION_LOCK_DECREF(c);
index 21ebbf17428728a6c6bdc76bf80dee663f18851b..ae1f893ce9f508b2a7e23a95f8f784579e3c295e 100644 (file)
@@ -578,7 +578,9 @@ done:
  * sends an abandon request.
  *
  * Being called from client_reset or request_abandon, the following hold:
- * - op->o_client_refcnt > 0 (and it follows that op->o_client != NULL)
+ * - noone else is processing the read part of the client connection (no new
+ *   operations come in there - relevant for the c_state checks)
+ * - op->o_client_refcnt > op->o_client_live (and it follows that op->o_client != NULL)
  */
 void
 operation_abandon( LloadOperation *op )
@@ -649,10 +651,19 @@ done:
     CONNECTION_LOCK(c);
     if ( c->c_state == LLOAD_C_BINDING ) {
         c->c_state = LLOAD_C_READY;
+        if ( !BER_BVISNULL( &c->c_auth ) ) {
+            ber_memfree( c->c_auth.bv_val );
+            BER_BVZERO( &c->c_auth );
+        }
+        if ( !BER_BVISNULL( &c->c_sasl_bind_mech ) ) {
+            ber_memfree( c->c_sasl_bind_mech.bv_val );
+            BER_BVZERO( &c->c_sasl_bind_mech );
+        }
         if ( op->o_pin_id ) {
             c->c_pin_id = 0;
         }
     }
+    assert( op->o_client_refcnt > op->o_client_live );
     op->o_client_refcnt--;
     operation_destroy_from_client( op );
     CONNECTION_UNLOCK(c);