futile searches for OC matches.
for ( an = a->acl_attrs; an && !BER_BVISNULL( &an->an_name ); an++ ) {
if ( ! first ) *ptr++ = ',';
if (an->an_oc) {
- *ptr++ = an->an_oc_exclude ? '!' : '@';
+ *ptr++ = ( an->an_flags & SLAP_AN_OCEXCLUDE ) ? '!' : '@';
ptr = lutil_strcopy( ptr, an->an_oc->soc_cname.bv_val );
} else {
* 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;
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++;
}
an[i].an_desc = NULL;
an[i].an_oc = NULL;
- an[i].an_oc_exclude = 0;
+ an[i].an_flags = 0;
rc = slap_bv2ad( &an[i].an_name, &an[i].an_desc, &dummy );
if ( rc == LDAP_SUCCESS ) {
an[i].an_name = an[i].an_desc->ad_cname;
(*filter_attrs)[*filter_cnt].an_desc = ad;
(*filter_attrs)[*filter_cnt].an_name = ad->ad_cname;
(*filter_attrs)[*filter_cnt].an_oc = NULL;
- (*filter_attrs)[*filter_cnt].an_oc_exclude = 0;
+ (*filter_attrs)[*filter_cnt].an_flags = 0;
BER_BVZERO( &(*filter_attrs)[*filter_cnt+1].an_name );
(*filter_cnt)++;
if ( ad == slap_schema.si_ad_objectClass )
(*new_attrs)[j].an_name = filter_attrs[i].an_name;
(*new_attrs)[j].an_desc = filter_attrs[i].an_desc;
(*new_attrs)[j].an_oc = NULL;
- (*new_attrs)[j].an_oc_exclude = 0;
+ (*new_attrs)[j].an_flags = 0;
j++;
}
if ( addoc ) {
(*new_attrs)[j].an_name = slap_schema.si_ad_objectClass->ad_cname;
(*new_attrs)[j].an_desc = slap_schema.si_ad_objectClass;
(*new_attrs)[j].an_oc = NULL;
- (*new_attrs)[j].an_oc_exclude = 0;
+ (*new_attrs)[j].an_flags = 0;
j++;
}
BER_BVZERO( &(*new_attrs)[j].an_name );
attr_name->an_name = attr_name->an_desc->ad_cname;
}
attr_name->an_oc = NULL;
- attr_name->an_oc_exclude = 0;
+ attr_name->an_flags = 0;
if ( attr_name->an_desc == slap_schema.si_ad_objectClass )
qm->attr_sets[num].flags |= PC_GOT_OC;
attr_name++;
const char *dummy; /* ignore msgs from bv2ad */
op->ors_attrs[i].an_desc = NULL;
op->ors_attrs[i].an_oc = NULL;
- op->ors_attrs[i].an_oc_exclude = 0;
+ op->ors_attrs[i].an_flags = 0;
if ( slap_bv2ad( &op->ors_attrs[i].an_name,
&op->ors_attrs[i].an_desc, &dummy ) != LDAP_SUCCESS )
{
#define SLAP_AD_PROXIED 0x01U
#define SLAP_AD_NOINSERT 0x02U
+#define SLAP_AN_OCEXCLUDE 0x01
+#define SLAP_AN_OCINITED 0x02
+
struct AttributeName {
struct berval an_name;
AttributeDescription *an_desc;
- int an_oc_exclude;
+ int an_flags;
ObjectClass *an_oc;
};
for ( i = 0; attrs[i] != NULL; i++ ) {
an[j].an_desc = NULL;
an[j].an_oc = NULL;
- an[j].an_oc_exclude = 0;
+ an[j].an_flags = 0;
an[j].an_name.bv_val = attrs[i];
an[j].an_name.bv_len = strlen( attrs[i] );
if ( slap_bv2ad( &an[j].an_name, &an[j].an_desc, &pb->pb_rs->sr_text ) == LDAP_SUCCESS ) {