+#endif /* SLAP_EXTENDED_SCHEMA */
+
+ /* check that the entry has required attrs for each oc */
+ for ( i = 0; aoc->a_vals[i].bv_val != NULL; i++ ) {
+ if ( (oc = oc_bvfind( &aoc->a_vals[i] )) == NULL ) {
+ snprintf( textbuf, textlen,
+ "unrecognized objectClass '%s'",
+ aoc->a_vals[i].bv_val );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn (%s), %s\n", e->e_dn, textbuf, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "entry_check_schema(%s): %s\n",
+ e->e_dn, textbuf, 0 );
+#endif
+
+ return LDAP_OBJECT_CLASS_VIOLATION;
+ }
+
+ if ( oc->soc_obsolete ) {
+ /* disallow obsolete classes */
+ snprintf( textbuf, textlen,
+ "objectClass '%s' is OBSOLETE",
+ aoc->a_vals[i].bv_val );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn (%s), %s\n", e->e_dn, textbuf, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "entry_check_schema(%s): %s\n",
+ e->e_dn, textbuf, 0 );
+#endif
+
+ return LDAP_OBJECT_CLASS_VIOLATION;
+ }
+
+ if ( oc->soc_check ) {
+ int rc = (oc->soc_check)( be, e, oc,
+ text, textbuf, textlen );
+ if( rc != LDAP_SUCCESS ) {
+ return rc;
+ }
+ }
+
+ if ( oc->soc_kind == LDAP_SCHEMA_ABSTRACT ) {
+ /* object class is abstract */
+ if ( oc != slap_schema.si_oc_top &&
+ !is_object_subclass( oc, sc ))
+ {
+ int j;
+ ObjectClass *xc = NULL;
+ for( j=0; aoc->a_vals[j].bv_val; j++ ) {
+ if( i != j ) {
+ xc = oc_bvfind( &aoc->a_vals[i] );
+ if( xc == NULL ) {
+ snprintf( textbuf, textlen,
+ "unrecognized objectClass '%s'",
+ aoc->a_vals[i].bv_val );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn (%s), %s\n",
+ e->e_dn, textbuf, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "entry_check_schema(%s): %s\n",
+ e->e_dn, textbuf, 0 );
+#endif
+
+ return LDAP_OBJECT_CLASS_VIOLATION;
+ }
+
+ /* since we previous check against the
+ * structural object of this entry, the
+ * abstract class must be a (direct or indirect)
+ * superclass of one of the auxiliary classes of
+ * the entry.
+ */
+ if ( xc->soc_kind == LDAP_SCHEMA_AUXILIARY &&
+ is_object_subclass( oc, xc ) )
+ {
+ xc = NULL;
+ break;
+ }
+ }
+ }
+
+ if( xc == NULL ) {
+ snprintf( textbuf, textlen, "instanstantiation of "
+ "abstract objectClass '%s' not allowed",
+ aoc->a_vals[i].bv_val );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn (%s), %s\n",
+ e->e_dn, textbuf, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "entry_check_schema(%s): %s\n",
+ e->e_dn, textbuf, 0 );
+#endif
+
+ return LDAP_OBJECT_CLASS_VIOLATION;
+ }
+ }
+
+ } else if ( oc->soc_kind != LDAP_SCHEMA_STRUCTURAL || oc == sc ) {
+ char *s;
+
+#ifdef SLAP_EXTENDED_SCHEMA
+ if( oc->soc_kind == LDAP_SCHEMA_AUXILIARY ) {
+ int k=0;
+ if( cr ) {
+ if( cr->scr_auxiliaries ) {
+ for( ; cr->scr_auxiliaries[k]; k++ ) {
+ if( cr->scr_auxiliaries[k] == oc ) {
+ k=-1;
+ break;
+ }
+ }
+ }
+ } else if ( global_disallows & SLAP_DISALLOW_AUX_WO_CR ) {
+ k=-1;
+ }
+
+ if( k == -1 ) {
+ snprintf( textbuf, textlen,
+ "content rule '%s' does not allow class '%s'",
+ ldap_contentrule2name( &cr->scr_crule ),
+ oc->soc_cname.bv_val );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn=\"%s\" %s",
+ e->e_dn, textbuf, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "Entry (%s): %s\n",
+ e->e_dn, textbuf, 0 );
+#endif
+
+ return LDAP_OBJECT_CLASS_VIOLATION;
+ }
+ }
+#endif /* SLAP_EXTENDED_SCHEMA */
+
+ s = oc_check_required( e, oc, &aoc->a_vals[i] );
+ if (s != NULL) {
+ snprintf( textbuf, textlen,
+ "object class '%s' requires attribute '%s'",
+ aoc->a_vals[i].bv_val, s );
+
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO,
+ "entry_schema_check: dn=\"%s\" %s", e->e_dn, textbuf, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "Entry (%s): %s\n",
+ e->e_dn, textbuf, 0 );
+#endif