Add conn/op bind_in_progress flags such that operations can detect

if multiple step SASL binds are in progress.
This commit is contained in:
Kurt Zeilenga 1999-07-02 00:04:47 +00:00
parent a1665712f2
commit 6f8fad20f2
3 changed files with 28 additions and 11 deletions

View File

@ -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 );
}

View File

@ -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;

View File

@ -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 */