From ddb9755ba7557a1a456431bc8af0bd02b21579dc Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 2 Mar 2000 00:59:10 +0000 Subject: [PATCH] Move handling of operations errors due to submission of non-bind requests while a multi-step SASL bind process is under to connection.c. Return LDAP_OPERATIONS_ERROR, not LDAP_SASL_BIND_IN_PROGRESS. --- servers/slapd/add.c | 7 ------- servers/slapd/compare.c | 8 -------- servers/slapd/connection.c | 13 +++++++++++-- servers/slapd/delete.c | 8 -------- servers/slapd/modify.c | 8 -------- servers/slapd/modrdn.c | 8 -------- servers/slapd/search.c | 8 -------- servers/slapd/slap.h | 1 - 8 files changed, 11 insertions(+), 50 deletions(-) diff --git a/servers/slapd/add.c b/servers/slapd/add.c index e7c6a82f42..3b20cde293 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -54,13 +54,6 @@ do_add( Connection *conn, Operation *op ) Debug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 ); - if( op->o_bind_in_progress ) { - Debug( LDAP_DEBUG_ANY, "do_add: SASL bind in progress.\n", 0, 0, 0 ); - send_ldap_result( conn, op, LDAP_SASL_BIND_IN_PROGRESS, NULL, - "SASL bind in progress", NULL, NULL ); - return LDAP_SASL_BIND_IN_PROGRESS; - } - /* * Parse the add request. It looks like this: * diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index 259698bc46..ae6d4e6ea2 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -49,14 +49,6 @@ do_compare( Debug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 ); - if( op->o_bind_in_progress ) { - Debug( LDAP_DEBUG_ANY, "do_compare: SASL bind in progress.\n", - 0, 0, 0 ); - send_ldap_result( conn, op, LDAP_SASL_BIND_IN_PROGRESS, - NULL, "SASL bind in progress", NULL, NULL ); - return LDAP_SASL_BIND_IN_PROGRESS; - } - /* * Parse the compare request. It looks like this: * diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 17dcffefd4..7237e5ae0b 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -730,6 +730,16 @@ connection_operation( void *arg_v ) num_ops_initiated++; ldap_pvt_thread_mutex_unlock( &num_ops_mutex ); + if( conn->c_bind_in_progress == 1 && tag != LDAP_REQ_BIND ) { + Debug( LDAP_DEBUG_ANY, + "connection_operation: SASL bind in progress.\n", + 0, 0, 0 ); + send_ldap_result( conn, arg->co_op, LDAP_OPERATIONS_ERROR, + NULL, "SASL bind in progress", NULL, NULL ); + rc = LDAP_OPERATIONS_ERROR; + goto operations_error; + } + switch ( tag ) { case LDAP_REQ_BIND: rc = do_bind( conn, arg->co_op ); @@ -783,6 +793,7 @@ connection_operation( void *arg_v ) if( rc == SLAPD_DISCONNECT ) tag = LBER_ERROR; +operations_error: ldap_pvt_thread_mutex_lock( &num_ops_mutex ); num_ops_completed++; ldap_pvt_thread_mutex_unlock( &num_ops_mutex ); @@ -1075,8 +1086,6 @@ static int connection_op_activate( Connection *conn, Operation *op ) arg->co_conn = conn; arg->co_op = op; - arg->co_op->o_bind_in_progress = conn->c_bind_in_progress; - arg->co_op->o_dn = ch_strdup( tmpdn != NULL ? tmpdn : "" ); arg->co_op->o_ndn = ch_strdup( arg->co_op->o_dn ); (void) dn_normalize( arg->co_op->o_ndn ); diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index 01d03f82f9..b63367214a 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -37,14 +37,6 @@ do_delete( Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 ); - if( op->o_bind_in_progress ) { - Debug( LDAP_DEBUG_ANY, "do_delete: SASL bind in progress.\n", - 0, 0, 0 ); - send_ldap_result( conn, op, LDAP_SASL_BIND_IN_PROGRESS, - NULL, "SASL bind in progress", NULL, NULL ); - return LDAP_SASL_BIND_IN_PROGRESS; - } - /* * Parse the delete request. It looks like this: * diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index df833bf573..7f953276a1 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -52,14 +52,6 @@ do_modify( Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 ); - if( op->o_bind_in_progress ) { - Debug( LDAP_DEBUG_ANY, "do_modify: SASL bind in progress.\n", - 0, 0, 0 ); - send_ldap_result( conn, op, LDAP_SASL_BIND_IN_PROGRESS, - NULL, "SASL bind in progress", NULL, NULL ); - return LDAP_SASL_BIND_IN_PROGRESS; - } - /* * Parse the modify request. It looks like this: * diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 78b56666d5..c6fd2ae6cf 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -56,14 +56,6 @@ do_modrdn( Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 ); - if( op->o_bind_in_progress ) { - Debug( LDAP_DEBUG_ANY, "do_modrdn: SASL bind in progress.\n", - 0, 0, 0 ); - send_ldap_result( conn, op, LDAP_SASL_BIND_IN_PROGRESS, - NULL, "SASL bind in progress", NULL, NULL ); - return LDAP_SASL_BIND_IN_PROGRESS; - } - /* * Parse the modrdn request. It looks like this: * diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 5ba446f899..41784771d1 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -44,14 +44,6 @@ do_search( Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 ); - if( op->o_bind_in_progress ) { - Debug( LDAP_DEBUG_ANY, "do_search: SASL bind in progress.\n", - 0, 0, 0 ); - send_ldap_result( conn, op, LDAP_SASL_BIND_IN_PROGRESS, - NULL, "SASL bind in progress", NULL, NULL ); - return LDAP_SASL_BIND_IN_PROGRESS; - } - /* * Parse the search request. It looks like this: * diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index a4dabc8247..f0f4a16a68 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -957,7 +957,6 @@ typedef struct slap_op { ber_tag_t o_tag; /* tag of the request */ time_t o_time; /* time op was initiated */ - int o_bind_in_progress; /* multi-step bind in progress */ #ifdef SLAP_AUTHZID /* should only be used for reporting purposes */ char *o_authc_dn; /* authentication DN */ -- 2.39.5