]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_check.c
More system schema checks
[openldap] / servers / slapd / schema_check.c
index 0b6b1ad09ef7d3713cde108227a7143b2a24f7a2..dc5842c187d05908bc58a6207effa31193479746 100644 (file)
@@ -30,7 +30,9 @@ static char * oc_check_required(
 
 int
 entry_schema_check( 
-       Entry *e, Attribute *oldattrs,
+       Backend *be,
+       Entry *e,
+       Attribute *oldattrs,
        const char** text,
        char *textbuf, size_t textlen )
 {
@@ -46,12 +48,20 @@ entry_schema_check(
 
        *text = textbuf;
 
-       /* check single-valued attrs for multiple values */
+       /* misc attribute checks */
        for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
                /* there should be at least one value */
                assert( a->a_vals );
                assert( a->a_vals[0].bv_val != NULL ); 
 
+               if( a->a_desc->ad_type->sat_check ) {
+                       int rc = (a->a_desc->ad_type->sat_check)(
+                               be, e, a, text, textbuf, textlen );
+                       if( rc != LDAP_SUCCESS ) {
+                               return rc;
+                       }
+               }
+
                /* if single value type, check for multiple values */
                if( is_at_single_value( a->a_desc->ad_type ) &&
                        a->a_vals[1].bv_val != NULL )
@@ -196,8 +206,16 @@ entry_schema_check(
 #endif
 
                        return LDAP_OBJECT_CLASS_VIOLATION;
+               }
 
-               } else if ( oc->soc_kind == LDAP_SCHEMA_ABSTRACT ) {
+               if ( oc->sco_check ) {
+                       int rc = (oc->sco_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 ))