From 6f8fad20f2d76ca38098cbbd5d420a10b8ce2346 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 2 Jul 1999 00:04:47 +0000 Subject: [PATCH] Add conn/op bind_in_progress flags such that operations can detect if multiple step SASL binds are in progress. --- servers/slapd/connection.c | 30 +++++++++++++++++++----------- servers/slapd/operation.c | 4 ++++ servers/slapd/slap.h | 5 +++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index bd3f1848ac..1df8b52800 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -602,6 +602,7 @@ void connection_done( Connection *c ) static void * connection_operation( void *arg_v ) { + int rc; struct co_arg *arg = arg_v; ber_tag_t tag = arg->co_op->o_tag; Connection *conn = arg->co_conn; @@ -612,44 +613,44 @@ connection_operation( void *arg_v ) switch ( tag ) { case LDAP_REQ_BIND: - do_bind( conn, arg->co_op ); + rc = do_bind( conn, arg->co_op ); break; case LDAP_REQ_UNBIND: - do_unbind( conn, arg->co_op ); + rc = do_unbind( conn, arg->co_op ); break; case LDAP_REQ_ADD: - do_add( conn, arg->co_op ); + rc = do_add( conn, arg->co_op ); break; case LDAP_REQ_DELETE: - do_delete( conn, arg->co_op ); + rc = do_delete( conn, arg->co_op ); break; case LDAP_REQ_MODRDN: - do_modrdn( conn, arg->co_op ); + rc = do_modrdn( conn, arg->co_op ); break; case LDAP_REQ_MODIFY: - do_modify( conn, arg->co_op ); + rc = do_modify( conn, arg->co_op ); break; case LDAP_REQ_COMPARE: - do_compare( conn, arg->co_op ); + rc = do_compare( conn, arg->co_op ); break; case LDAP_REQ_SEARCH: - do_search( conn, arg->co_op ); + rc = do_search( conn, arg->co_op ); break; case LDAP_REQ_ABANDON: - do_abandon( conn, arg->co_op ); + rc = do_abandon( conn, arg->co_op ); break; #if 0 case LDAP_REQ_EXTENDED: - do_extended( conn, arg->co_op ); + rc = do_extended( conn, arg->co_op ); break; #endif @@ -685,6 +686,7 @@ connection_operation( void *arg_v ) if( conn->c_conn_state == SLAP_C_BINDING) { conn->c_conn_state = SLAP_C_ACTIVE; } + conn->c_bind_in_progress = ( rc == LDAP_SASL_BIND_IN_PROGRESS ); } ldap_pvt_thread_mutex_lock( &active_threads_mutex ); @@ -907,18 +909,24 @@ 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 = dn_normalize_case( ch_strdup( arg->co_op->o_dn ) ); arg->co_op->o_protocol = conn->c_protocol; + arg->co_op->o_authmech = conn->c_authmech != NULL + ? ch_strdup( conn->c_authmech ) : NULL; + arg->co_op->o_authtype = conn->c_authtype; + slap_op_add( &conn->c_ops, arg->co_op ); if(tag == LDAP_REQ_BIND) { conn->c_conn_state = SLAP_C_BINDING; } - if ( tmpdn != NULL ) { + if( tmpdn != NULL ) { free( tmpdn ); } diff --git a/servers/slapd/operation.c b/servers/slapd/operation.c index 6f6ab510ef..ddad7b9064 100644 --- a/servers/slapd/operation.c +++ b/servers/slapd/operation.c @@ -24,6 +24,9 @@ slap_op_free( Operation *op ) if ( op->o_ndn != NULL ) { free( op->o_ndn ); } + if ( op->o_authmech != NULL ) { + free( op->o_authmech ); + } ldap_pvt_thread_mutex_destroy( &op->o_abandonmutex ); @@ -51,6 +54,7 @@ slap_op_alloc( op->o_dn = NULL; op->o_ndn = NULL; + op->o_authmech = NULL; op->o_time = slap_get_time(); op->o_opid = id; diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index de4c6cd45c..4edb275b89 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -490,6 +490,9 @@ 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-op bind in progress */ + char *o_dn; /* dn bound when op was initiated */ char *o_ndn; /* normalized dn bound when op was initiated */ ber_int_t o_protocol; /* version of the LDAP protocol used by client */ @@ -534,6 +537,8 @@ typedef struct slap_conn { char *c_client_name; /* name of client */ /* only can be changed by binding thread */ + int c_bind_in_progress; /* multi-op bind in progress */ + char *c_cdn; /* DN provided by the client */ char *c_dn; /* DN bound to this conn */ ber_int_t c_protocol; /* version of the LDAP protocol used by client */ -- 2.39.5