/* oc.c - object class routines */
/* $OpenLDAP$ */
/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
int is_entry_objectclass(
Entry* e,
- ObjectClass *oc )
+ ObjectClass *oc,
+ int set_flags )
{
Attribute *attr;
struct berval *bv;
return 0;
}
+ if( set_flags && ( e->e_ocflags & SLAP_OC__END )) {
+ return (e->e_ocflags & oc->soc_flags);
+ }
+
/*
* find objectClass attribute
*/
for( bv=attr->a_vals; bv->bv_val; bv++ ) {
ObjectClass *objectClass = oc_bvfind( bv );
- if( objectClass == oc ) {
+ if ( objectClass == oc && !set_flags ) {
return 1;
}
+
+ if ( objectClass != NULL ) {
+ e->e_ocflags |= objectClass->soc_flags;
+ }
}
+ e->e_ocflags |= SLAP_OC__END; /* We've finished this */
- return 0;
-
+ return (e->e_ocflags & oc->soc_flags);
}
}
}
+ if ( !OID_LEADCHAR( oc->oc_oid[0] )) {
+ /* Expand OID macros */
+ char *oid = oidm_find( oc->oc_oid );
+ if ( !oid ) {
+ *err = oc->oc_oid;
+ return SLAP_SCHERR_OIDM;
+ }
+ if ( oid != oc->oc_oid ) {
+ ldap_memfree( oc->oc_oid );
+ oc->oc_oid = oid;
+ }
+ }
+
soc = (ObjectClass *) ch_calloc( 1, sizeof(ObjectClass) );
AC_MEMCPY( &soc->soc_oclass, oc, sizeof(LDAPObjectClass) );