Commit ffdd4f83 authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount
Browse files

Add AttributeDescription counter

parent 36a7423b
......@@ -74,6 +74,8 @@ static int option_count = 1;
static int msad_range_hack = 0;
static int ad_count;
static Attr_option *ad_find_option_definition( const char *opt, int optlen );
int ad_keystring(
......@@ -382,6 +384,9 @@ done:;
d2->ad_flags = desc.ad_flags;
d2->ad_cname.bv_len = desc.ad_type->sat_cname.bv_len;
d2->ad_tags.bv_len = desc.ad_tags.bv_len;
ldap_pvt_thread_mutex_lock( &ad_index_mutex );
d2->ad_index = ++ad_count;
ldap_pvt_thread_mutex_unlock( &ad_index_mutex );
if (dlen == 0) {
d2->ad_cname.bv_val = d2->ad_type->sat_cname.bv_val;
......@@ -770,6 +775,7 @@ int slap_bv2undef_ad(
/* shouldn't we protect this for concurrency? */
desc->ad_type = at;
desc->ad_index = 0;
ldap_pvt_thread_mutex_lock( &ad_undef_mutex );
desc->ad_next = desc->ad_type->sat_ad;
desc->ad_type->sat_ad = desc;
......
......@@ -2051,6 +2051,7 @@ LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) entry2str_mutex;
#define gmtime_mutex ldap_int_gmtime_mutex
#endif /* ! LDAP_DEVEL */
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) ad_index_mutex;
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) ad_undef_mutex;
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) oc_undef_mutex;
......
......@@ -164,6 +164,7 @@ unsigned int index_intlen = SLAP_INDEX_INTLEN_DEFAULT;
unsigned int index_intlen_strlen = SLAP_INDEX_INTLEN_STRLEN(
SLAP_INDEX_INTLEN_DEFAULT );
ldap_pvt_thread_mutex_t ad_index_mutex;
ldap_pvt_thread_mutex_t ad_undef_mutex;
ldap_pvt_thread_mutex_t oc_undef_mutex;
......@@ -6849,6 +6850,7 @@ schema_destroy( void )
syn_destroy();
if( schema_init_done ) {
ldap_pvt_thread_mutex_destroy( &ad_index_mutex );
ldap_pvt_thread_mutex_destroy( &ad_undef_mutex );
ldap_pvt_thread_mutex_destroy( &oc_undef_mutex );
}
......
......@@ -1161,6 +1161,7 @@ slap_schema_load( void )
slap_at_proxied.sat_syntax = slap_schema.si_syn_octetString;
slap_schema.si_at_proxied = &slap_at_proxied;
ldap_pvt_thread_mutex_init( &ad_index_mutex );
ldap_pvt_thread_mutex_init( &ad_undef_mutex );
ldap_pvt_thread_mutex_init( &oc_undef_mutex );
......
......@@ -850,6 +850,7 @@ struct AttributeDescription {
#define SLAP_DESC_BINARY 0x01U
#define SLAP_DESC_TAG_RANGE 0x80U
#define SLAP_DESC_TEMPORARY 0x1000U
unsigned ad_index;
};
/* flags to slap_*2undef_ad to register undefined (0, the default)
......
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