/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2009 The OpenLDAP Foundation.
+ * Copyright 1998-2011 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
static int msad_range_hack = 0;
+static int ad_count;
+
static Attr_option *ad_find_option_definition( const char *opt, int optlen );
-static int ad_keystring(
+int ad_keystring(
struct berval *bv )
{
ber_len_t i;
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;
* else if requested description is !objectClass, return
* attributes which the class does not require/allow
*/
- oc = attrs->an_oc;
- if( oc == NULL && attrs->an_name.bv_val ) {
- switch( attrs->an_name.bv_val[0] ) {
- case '@': /* @objectClass */
- case '+': /* +objectClass (deprecated) */
- case '!': { /* exclude */
- struct berval ocname;
- ocname.bv_len = attrs->an_name.bv_len - 1;
- ocname.bv_val = &attrs->an_name.bv_val[1];
- oc = oc_bvfind( &ocname );
- attrs->an_oc_exclude = 0;
- if ( oc && attrs->an_name.bv_val[0] == '!' ) {
- attrs->an_oc_exclude = 1;
- }
- } break;
+ if ( !( attrs->an_flags & SLAP_AN_OCINITED )) {
+ if( attrs->an_name.bv_val ) {
+ switch( attrs->an_name.bv_val[0] ) {
+ case '@': /* @objectClass */
+ case '+': /* +objectClass (deprecated) */
+ case '!': { /* exclude */
+ struct berval ocname;
+ ocname.bv_len = attrs->an_name.bv_len - 1;
+ ocname.bv_val = &attrs->an_name.bv_val[1];
+ oc = oc_bvfind( &ocname );
+ if ( oc && attrs->an_name.bv_val[0] == '!' ) {
+ attrs->an_flags |= SLAP_AN_OCEXCLUDE;
+ } else {
+ attrs->an_flags &= ~SLAP_AN_OCEXCLUDE;
+ }
+ } break;
- default: /* old (deprecated) way */
- oc = oc_bvfind( &attrs->an_name );
+ default: /* old (deprecated) way */
+ oc = oc_bvfind( &attrs->an_name );
+ }
+ attrs->an_oc = oc;
}
- attrs->an_oc = oc;
+ attrs->an_flags |= SLAP_AN_OCINITED;
}
+ oc = attrs->an_oc;
if( oc != NULL ) {
- if ( attrs->an_oc_exclude ) {
+ if ( attrs->an_flags & SLAP_AN_OCEXCLUDE ) {
if ( oc == slap_schema.si_oc_extensibleObject ) {
/* extensibleObject allows the return of anything */
return 0;
/* 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;
anew->an_desc = NULL;
anew->an_oc = NULL;
- anew->an_oc_exclude = 0;
+ anew->an_flags = 0;
ber_str2bv(s, 0, 1, &anew->an_name);
slap_bv2ad(&anew->an_name, &anew->an_desc, &text);
if ( !anew->an_desc ) {
}
if ( anew->an_name.bv_val[0] == '!' ) {
- anew->an_oc_exclude = 1;
+ anew->an_flags |= SLAP_AN_OCEXCLUDE;
}
} break;
}
}
}
+ anew->an_flags |= SLAP_AN_OCINITED;
anew++;
}