]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_check.c
cleanup
[openldap] / servers / slapd / schema_check.c
index 40ca1d54a156440d8afcd68bbd954d4ed45e9599..ccabe6dc17bb9fc394e1b0f6ab966a0eea319ef0 100644 (file)
@@ -1,8 +1,17 @@
 /* schema_check.c - routines to enforce schema definitions */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
  */
 
 #include "portable.h"
@@ -227,14 +236,14 @@ entry_schema_check(
        }
 
        /* naming check */
-        if ( !is_entry_objectclass ( e, slap_schema.si_oc_glue, 0 ) ) {
-                rc = entry_naming_check( e, text, textbuf, textlen );
-                if( rc != LDAP_SUCCESS ) {
-                        return rc;
-                }
-        } else {
-                       /* Glue Entry */
-        }
+       if ( !is_entry_objectclass ( e, slap_schema.si_oc_glue, 0 ) ) {
+               rc = entry_naming_check( e, text, textbuf, textlen );
+               if( rc != LDAP_SUCCESS ) {
+                       return rc;
+               }
+       } else {
+               /* Glue Entry */
+       }
 
        /* find the content rule for the structural class */
        cr = cr_find( sc->soc_oid );
@@ -719,7 +728,7 @@ int structural_class(
                                        if( xc == NULL ) {
                                                snprintf( textbuf, textlen,
                                                        "unrecognized objectClass '%s'",
-                                                       ocs[i].bv_val );
+                                                       ocs[j].bv_val );
                                                *text = textbuf;
                                                return LDAP_OBJECT_CLASS_VIOLATION;
                                        }
@@ -854,7 +863,31 @@ entry_naming_check(
                        break;
                }
 
-               if( desc->ad_type->sat_equality == NULL ) {
+               if( desc->ad_type->sat_usage ) {
+                       snprintf( textbuf, textlen, 
+                               "naming attribute '%s' is operational",
+                               ava->la_attr.bv_val );
+                       rc = LDAP_NAMING_VIOLATION;
+                       break;
+               }
+               if( desc->ad_type->sat_collective ) {
+                       snprintf( textbuf, textlen, 
+                               "naming attribute '%s' is collective",
+                               ava->la_attr.bv_val );
+                       rc = LDAP_NAMING_VIOLATION;
+                       break;
+               }
+
+               if( desc->ad_type->sat_obsolete ) {
+                       snprintf( textbuf, textlen, 
+                               "naming attribute '%s' is obsolete",
+                               ava->la_attr.bv_val );
+                       rc = LDAP_NAMING_VIOLATION;
+                       break;
+               }
+
+               if( !desc->ad_type->sat_equality ) {
                        snprintf( textbuf, textlen, 
                                "naming attribute '%s' has no equality matching rule",
                                ava->la_attr.bv_val );
@@ -862,7 +895,7 @@ entry_naming_check(
                        break;
                }
 
-               if( desc->ad_type->sat_equality->smr_match == NULL ) {
+               if( !desc->ad_type->sat_equality->smr_match ) {
                        snprintf( textbuf, textlen, 
                                "naming attribute '%s' has unsupported equality matching rule",
                                ava->la_attr.bv_val );