Commit de90dbbc authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

mutex-protect "undefined" attribute descriptions/objectClasses addition (ITS#3958)

parent a3554aad
......@@ -737,9 +737,12 @@ int slap_bv2undef_ad(
/* canonical to upper case */
ldap_pvt_str2upper( desc->ad_cname.bv_val );
desc->ad_type = slap_schema.si_at_undefined;
/* shouldn't we protect this for concurrency? */
desc->ad_type = at;
ldap_pvt_thread_mutex_lock( &ad_undef_mutex );
desc->ad_next = desc->ad_type->sat_ad;
desc->ad_type->sat_ad = desc;
ldap_pvt_thread_mutex_unlock( &ad_undef_mutex );
}
if( !*ad ) {
......
......@@ -227,7 +227,9 @@ oc_bvfind_undef( struct berval *ocname )
AC_MEMCPY( oc->soc_cname.bv_val, ocname->bv_val, ocname->bv_len );
LDAP_STAILQ_NEXT( oc, soc_next ) = NULL;
ldap_pvt_thread_mutex_lock( &oc_undef_mutex );
LDAP_STAILQ_INSERT_HEAD( &oc_undef_list, oc, soc_next );
ldap_pvt_thread_mutex_unlock( &oc_undef_mutex );
return oc;
}
......
......@@ -1704,6 +1704,9 @@ LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) replog_mutex;
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) gmtime_mutex;
#endif
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) ad_undef_mutex;
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) oc_undef_mutex;
LDAP_SLAPD_V (ber_socket_t) dtblsize;
LDAP_SLAPD_V (int) use_reverse_lookup;
......
......@@ -79,6 +79,9 @@ unsigned int index_substr_if_maxlen = SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT;
unsigned int index_substr_any_len = SLAP_INDEX_SUBSTR_ANY_LEN_DEFAULT;
unsigned int index_substr_any_step = SLAP_INDEX_SUBSTR_ANY_STEP_DEFAULT;
ldap_pvt_thread_mutex_t ad_undef_mutex;
ldap_pvt_thread_mutex_t oc_undef_mutex;
static int
inValidate(
Syntax *syntax,
......@@ -3966,4 +3969,7 @@ schema_destroy( void )
mr_destroy();
mru_destroy();
syn_destroy();
ldap_pvt_thread_mutex_destroy( &ad_undef_mutex );
ldap_pvt_thread_mutex_destroy( &oc_undef_mutex );
}
......@@ -1143,6 +1143,12 @@ slap_schema_load( void )
}
}
slap_at_undefined.sat_syntax = slap_schema.si_syn_octetString;
slap_schema.si_at_undefined = &slap_at_undefined;
ldap_pvt_thread_mutex_init( &ad_undef_mutex );
ldap_pvt_thread_mutex_init( &oc_undef_mutex );
for( i=0; ad_map[i].ssam_name; i++ ) {
assert( ad_map[i].ssam_defn != NULL );
{
......@@ -1313,9 +1319,6 @@ slap_schema_load( void )
}
}
slap_at_undefined.sat_syntax = slap_schema.si_syn_octetString;
slap_schema.si_at_undefined = &slap_at_undefined;
return LDAP_SUCCESS;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment