]> git.sur5r.net Git - openldap/commitdiff
Add some OBSOLETE schema checks
authorKurt Zeilenga <kurt@openldap.org>
Thu, 10 Oct 2002 02:07:24 +0000 (02:07 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 10 Oct 2002 02:07:24 +0000 (02:07 +0000)
servers/slapd/at.c
servers/slapd/oc.c
servers/slapd/schema_check.c

index 42c1b7a39653e708378f5ee157976c2a0abbfe21..7a6af1f79ae0a05e3eec906679c6e9fa064cdac6 100644 (file)
@@ -405,6 +405,11 @@ at_add(
                        return SLAP_SCHERR_ATTR_BAD_USAGE;
                }
 
+               if ( supsat->sat_obsolete && !sat->sat_obsolete ) {
+                       /* subtypes must be obsolete if super is */
+                       return SLAP_SCHERR_ATTR_BAD_SUP;
+               }
+
                if ( sat->sat_flags & SLAP_AT_FINAL ) {
                        /* cannot subtype a "final" attribute type */
                        return SLAP_SCHERR_ATTR_BAD_SUP;
index 3301a702bb9567b6d39104ff3e789793b3a49b83..ff6a81830344bcc302d320d8a37f87a2e846a67b 100644 (file)
@@ -289,6 +289,11 @@ oc_add_sups(
                                return SLAP_SCHERR_CLASS_BAD_SUP;
                        }
 
+                       if( soc1->soc_obsolete && !soc->soc_obsolete ) {
+                               *err = *sups1;
+                               return SLAP_SCHERR_CLASS_BAD_SUP;
+                       }
+
                        if( soc->soc_flags & SLAP_OC_OPERATIONAL ) (*op)++;
 
                        if ( add_sups ) {
index ac1986161be24c37062bf8e0da17fdc7770a7446..1fcc4ab6de2ea3e985e44374dd68a736525212e1 100644 (file)
@@ -161,6 +161,23 @@ entry_schema_check(
                return LDAP_OTHER;
        }
 
+       if( sc->soc_obsolete ) {
+               snprintf( textbuf, textlen, 
+                       "structuralObjectClass '%s' is OBSOLETE",
+                       asc->a_vals[0].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;
+       }
+
        /* find the object class attribute */
        aoc = attr_find( e->e_attrs, ad_objectClass );
        if ( aoc == NULL ) {
@@ -208,8 +225,25 @@ entry_schema_check(
        assert( !cr || !strcmp( cr->scr_oid, sc->soc_oid ) );
 
        /* check that the entry has required attrs of the content rule */
-       if( cr && cr->scr_required ) {
-               for( i=0; cr->scr_required[i]; i++ ) {
+       if( cr ) {
+               if( cr->scr_obsolete ) {
+                       snprintf( textbuf, textlen, 
+                               "content rule '%s' is obsolete",
+                               ldap_contentrule2name( &cr->scr_crule ));
+
+#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;
+               }
+
+               if( cr->scr_required ) for( i=0; cr->scr_required[i]; i++ ) {
                        at = cr->scr_required[i];
 
                        for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
@@ -237,10 +271,8 @@ entry_schema_check(
                                return LDAP_OBJECT_CLASS_VIOLATION;
                        }
                }
-       }
 
-       if( cr && cr->scr_precluded ) {
-               for( i=0; cr->scr_precluded[i]; i++ ) {
+               if( cr->scr_precluded ) for( i=0; cr->scr_precluded[i]; i++ ) {
                        at = cr->scr_precluded[i];
 
                        for ( a = e->e_attrs; a != NULL; a = a->a_next ) {