From bdb2cc570c8adf9f450c0800dd3a1dd3209fc06a Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Mon, 17 Nov 2008 23:53:49 +0000 Subject: [PATCH] ITS#5814 --- CHANGES | 1 + servers/slapd/connection.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 73b035c3b7..e654b2d9c4 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ OpenLDAP 2.4.13 Engineering Fixed slapd acl checks on ADD (ITS#4556,ITS#5723) Fixed slapd acl application to newly created backends (ITS#5572) Added slapd keyword add_content_acl for add checks (ITS#4556,ITS#5723) + Fixed slapd concurrent access to connections (ITS#5814) Fixed slapd config backend olcLogFile support (ITS#5765) Fixed slapd contextCSN pending list (ITS#5709) Fixed slapd control criticality (ITS#5785) diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index ce36494b52..22dbd8513e 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -423,8 +423,10 @@ Connection * connection_init( if ( flags & CONN_IS_CLIENT ) { c->c_connid = 0; + ldap_pvt_thread_mutex_lock( &connections_mutex ); c->c_conn_state = SLAP_C_CLIENT; c->c_struct_state = SLAP_C_USED; + ldap_pvt_thread_mutex_unlock( &connections_mutex ); c->c_close_reason = "?"; /* should never be needed */ ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_FD, &sfd ); ldap_pvt_thread_mutex_unlock( &c->c_mutex ); @@ -508,8 +510,10 @@ Connection * connection_init( id = c->c_connid = conn_nextid++; ldap_pvt_thread_mutex_unlock( &conn_nextid_mutex ); + ldap_pvt_thread_mutex_lock( &connections_mutex ); c->c_conn_state = SLAP_C_INACTIVE; c->c_struct_state = SLAP_C_USED; + ldap_pvt_thread_mutex_unlock( &connections_mutex ); c->c_close_reason = "?"; /* should never be needed */ c->c_ssf = c->c_transport_ssf = ssf; @@ -843,12 +847,12 @@ Connection* connection_next( Connection *c, ber_socket_t *index ) for(; *index < dtblsize; (*index)++) { int c_struct; if( connections[*index].c_struct_state == SLAP_C_UNINITIALIZED ) { + /* FIXME: accessing c_conn_state without locking c_mutex */ assert( connections[*index].c_conn_state == SLAP_C_INVALID ); continue; } if( connections[*index].c_struct_state == SLAP_C_USED ) { - assert( connections[*index].c_conn_state != SLAP_C_INVALID ); c = &connections[(*index)++]; if ( ldap_pvt_thread_mutex_trylock( &c->c_mutex )) { /* avoid deadlock */ @@ -861,6 +865,7 @@ Connection* connection_next( Connection *c, ber_socket_t *index ) continue; } } + assert( c->c_conn_state != SLAP_C_INVALID ); break; } @@ -868,6 +873,7 @@ Connection* connection_next( Connection *c, ber_socket_t *index ) if ( c_struct == SLAP_C_PENDING ) continue; assert( c_struct == SLAP_C_UNUSED ); + /* FIXME: accessing c_conn_state without locking c_mutex */ assert( connections[*index].c_conn_state == SLAP_C_INVALID ); } -- 2.39.5