From: Kurt Zeilenga Date: Thu, 10 Oct 2002 02:07:24 +0000 (+0000) Subject: Add some OBSOLETE schema checks X-Git-Tag: NO_SLAP_OP_BLOCKS~898 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=857165b1bf23cae8ae7261d9f0a2207847f938bf;p=openldap Add some OBSOLETE schema checks --- diff --git a/servers/slapd/at.c b/servers/slapd/at.c index 42c1b7a396..7a6af1f79a 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -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; diff --git a/servers/slapd/oc.c b/servers/slapd/oc.c index 3301a702bb..ff6a818303 100644 --- a/servers/slapd/oc.c +++ b/servers/slapd/oc.c @@ -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 ) { diff --git a/servers/slapd/schema_check.c b/servers/slapd/schema_check.c index ac1986161b..1fcc4ab6de 100644 --- a/servers/slapd/schema_check.c +++ b/servers/slapd/schema_check.c @@ -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 ) {