From af7ce80c85763121a1c388d00fee319d5b404973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Fri, 23 Jun 2017 10:10:03 +0100 Subject: [PATCH] Remember and clear bind status correctly --- servers/lloadd/bind.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/servers/lloadd/bind.c b/servers/lloadd/bind.c index 4757024cc5..6a2de443c1 100644 --- a/servers/lloadd/bind.c +++ b/servers/lloadd/bind.c @@ -315,6 +315,9 @@ client_bind( Connection *client, Operation *op ) client->c_type = SLAP_C_OPEN; client_reset( client ); + + rc = tavl_insert( &client->c_ops, op, operation_client_cmp, avl_dup_error ); + assert( rc == LDAP_SUCCESS ); CONNECTION_UNLOCK_INCREF(client); upstream = backend_select( op ); @@ -355,10 +358,18 @@ client_bind( Connection *client, Operation *op ) if ( !--op->o_client_refcnt ) { operation_destroy_from_client( op ); - } else { - rc = tavl_insert( - &client->c_ops, op, operation_client_cmp, avl_dup_error ); - assert( rc == LDAP_SUCCESS ); + if ( client->c_state == SLAP_C_BINDING ) { + client->c_state = SLAP_C_READY; + client->c_type = SLAP_C_OPEN; + if ( !BER_BVISNULL( &client->c_auth ) ) { + ber_memfree( client->c_auth.bv_val ); + BER_BVZERO( &client->c_auth ); + } + if ( !BER_BVISNULL( &client->c_sasl_bind_mech ) ) { + ber_memfree( client->c_sasl_bind_mech.bv_val ); + BER_BVZERO( &client->c_sasl_bind_mech ); + } + } } return rc;