int is_entry_objectclass(
Entry* e,
ObjectClass *oc,
- int set_flags )
+ unsigned flags )
{
/*
* set_flags should only be true if oc is one of operational
Attribute *attr;
struct berval *bv;
- AttributeDescription *objectClass = slap_schema.si_ad_objectClass;
- assert(!( e == NULL || oc == NULL ));
+ assert( !( e == NULL || oc == NULL ) );
+ assert( ( flags & SLAP_OCF_MASK ) != SLAP_OCF_MASK );
if( e == NULL || oc == NULL ) {
return 0;
}
- if( set_flags && ( e->e_ocflags & SLAP_OC__END )) {
+ if( flags == SLAP_OCF_SET_FLAGS && ( e->e_ocflags & SLAP_OC__END ) )
+ {
/* flags are set, use them */
return (e->e_ocflags & oc->soc_flags & SLAP_OC__MASK) != 0;
}
/*
* find objectClass attribute
*/
- attr = attr_find(e->e_attrs, objectClass);
+ attr = attr_find( e->e_attrs, slap_schema.si_ad_objectClass );
if( attr == NULL ) {
/* no objectClass attribute */
Debug( LDAP_DEBUG_ANY, "is_entry_objectclass(\"%s\", \"%s\") "
for( bv=attr->a_vals; bv->bv_val; bv++ ) {
ObjectClass *objectClass = oc_bvfind( bv );
- if ( !set_flags && objectClass == oc ) {
- return 1;
+ if ( objectClass == NULL ) {
+ /* FIXME: is this acceptable? */
+ continue;
}
-
- if ( objectClass != NULL ) {
- e->e_ocflags |= objectClass->soc_flags;
+
+ if ( !( flags & SLAP_OCF_SET_FLAGS ) ) {
+ if ( objectClass == oc ) {
+ return 1;
+ }
+
+ if ( ( flags & SLAP_OCF_CHECK_SUP )
+ && is_object_subclass( oc, objectClass ) )
+ {
+ return 1;
+ }
}
+
+ e->e_ocflags |= objectClass->soc_flags;
}
/* mark flags as set */
e->e_ocflags |= SLAP_OC__END;
- return (e->e_ocflags & oc->soc_flags & SLAP_OC__MASK) != 0;
+ return ( e->e_ocflags & oc->soc_flags & SLAP_OC__MASK ) != 0;
}
ObjectClass *sub ));
LDAP_SLAPD_F (int) is_entry_objectclass LDAP_P((
- Entry *, ObjectClass *oc, int set_flags ));
+ Entry *, ObjectClass *oc, unsigned flags ));
+#define is_entry_objectclass_or_sub(e,oc) \
+ (is_entry_objectclass((e),(oc),SLAP_OCF_CHECK_SUP))
#define is_entry_alias(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_ALIAS) != 0) \
- : is_entry_objectclass((e), slap_schema.si_oc_alias, 1))
+ : is_entry_objectclass((e), slap_schema.si_oc_alias, SLAP_OCF_SET_FLAGS))
#define is_entry_referral(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_REFERRAL) != 0) \
- : is_entry_objectclass((e), slap_schema.si_oc_referral, 1))
+ : is_entry_objectclass((e), slap_schema.si_oc_referral, SLAP_OCF_SET_FLAGS))
#define is_entry_subentry(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_SUBENTRY) != 0) \
- : is_entry_objectclass((e), slap_schema.si_oc_subentry, 1))
+ : is_entry_objectclass((e), slap_schema.si_oc_subentry, SLAP_OCF_SET_FLAGS))
#define is_entry_collectiveAttributeSubentry(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_COLLECTIVEATTRIBUTESUBENTRY) != 0) \
- : is_entry_objectclass((e), slap_schema.si_oc_collectiveAttributeSubentry, 1))
+ : is_entry_objectclass((e), slap_schema.si_oc_collectiveAttributeSubentry, SLAP_OCF_SET_FLAGS))
#define is_entry_dynamicObject(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_DYNAMICOBJECT) != 0) \
- : is_entry_objectclass((e), slap_schema.si_oc_dynamicObject, 1))
+ : is_entry_objectclass((e), slap_schema.si_oc_dynamicObject, SLAP_OCF_SET_FLAGS))
#define is_entry_glue(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_GLUE) != 0) \
- : is_entry_objectclass((e), slap_schema.si_oc_glue, 1))
+ : is_entry_objectclass((e), slap_schema.si_oc_glue, SLAP_OCF_SET_FLAGS))
#define is_entry_syncProviderSubentry(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_SYNCPROVIDERSUBENTRY) != 0) \
- : is_entry_objectclass((e), slap_schema.si_oc_syncProviderSubentry, 1))
+ : is_entry_objectclass((e), slap_schema.si_oc_syncProviderSubentry, SLAP_OCF_SET_FLAGS))
#define is_entry_syncConsumerSubentry(e) \
(((e)->e_ocflags & SLAP_OC__END) \
? (((e)->e_ocflags & SLAP_OC_SYNCCONSUMERSUBENTRY) != 0) \
- : is_entry_objectclass((e), slap_schema.si_oc_syncConsumerSubentry, 1))
+ : is_entry_objectclass((e), slap_schema.si_oc_syncConsumerSubentry, SLAP_OCF_SET_FLAGS))
LDAP_SLAPD_F (int) oc_schema_info( Entry *e );
LDAP_SLAPD_F (void) oc_unparse LDAP_P((