]> git.sur5r.net Git - openldap/commitdiff
Additional invalid objectClass changes (ITS#3097)
authorKurt Zeilenga <kurt@openldap.org>
Mon, 19 Apr 2004 20:45:26 +0000 (20:45 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 19 Apr 2004 20:45:26 +0000 (20:45 +0000)
catch error in validation/pretty functions

servers/slapd/proto-slap.h
servers/slapd/schema_init.c
servers/slapd/schema_prep.c

index 522fff8e7295397cf2cfc4dd09404b303a162db5..b7c77caaff0dc5f495b0b1544914828834645d66 100644 (file)
@@ -1056,10 +1056,12 @@ LDAP_SLAPD_V( int ) schema_init_done;
 LDAP_SLAPD_F (int) slap_schema_init LDAP_P((void));
 LDAP_SLAPD_F (void) schema_destroy LDAP_P(( void ));
 
-LDAP_SLAPD_F( slap_mr_indexer_func ) octetStringIndexer;
+LDAP_SLAPD_F( slap_syntax_validate_func ) numericoidValidate;
 
+LDAP_SLAPD_F( slap_mr_indexer_func ) octetStringIndexer;
 LDAP_SLAPD_F( slap_mr_filter_func ) octetStringFilter;
 
+
 /*
  * schema_prep.c
  */
index 499935beed43b870e1e0d94b28d0b5824958dd32..9465c17d677a575351fb36ad36aaf35e6da7713a 100644 (file)
@@ -1502,7 +1502,7 @@ telephoneNumberNormalize(
        return LDAP_SUCCESS;
 }
 
-static int
+int
 numericoidValidate(
        Syntax *syntax,
        struct berval *in )
index e0b082ad07b6410080f5e88eb63a5c38c16d2334..dffa3bf4fa140b6b4e916f6a1909dba13d1cab80 100644 (file)
@@ -32,6 +32,20 @@ int schema_init_done = 0;
 
 struct slap_internal_schema slap_schema;
 
+static int objectClassValidate(
+       Syntax *syntax,
+       struct berval *in )
+{
+       ObjectClass *oc;
+       int rc = numericoidValidate( syntax, in );
+       if ( rc ) return rc;
+
+       oc = oc_bvfind( in );
+       if( oc == NULL ) return LDAP_INVALID_SYNTAX;
+
+       return LDAP_SUCCESS;
+}
+
 static int objectClassPretty(
        struct slap_syntax *syntax,
        struct berval * in,
@@ -39,13 +53,9 @@ static int objectClassPretty(
        void *ctx )
 {
        ObjectClass *oc = oc_bvfind( in );
+       if( oc == NULL ) return LDAP_INVALID_SYNTAX;
 
-       if( oc != NULL ) {
-               ber_dupbv_x( out, &oc->soc_cname, ctx );
-       } else {
-               ber_dupbv_x( out, in, ctx );
-       }
-
+       ber_dupbv_x( out, &oc->soc_cname, ctx );
        return LDAP_SUCCESS;
 }
 
@@ -283,7 +293,7 @@ static struct slap_schema_ad_map {
                        "EQUALITY objectIdentifierMatch "
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
                NULL, SLAP_AT_FINAL,
-               NULL, objectClassPretty,
+               objectClassValidate, objectClassPretty,
                NULL, NULL, objectSubClassMatch,
                        objectSubClassIndexer, objectSubClassFilter,
                offsetof(struct slap_internal_schema, si_ad_objectClass) },
@@ -295,7 +305,7 @@ static struct slap_schema_ad_map {
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 "
                        "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
                NULL, 0,
-               NULL, objectClassPretty,
+               objectClassValidate, objectClassPretty,
                NULL, NULL, objectSubClassMatch,
                        objectSubClassIndexer, objectSubClassFilter,
                offsetof(struct slap_internal_schema, si_ad_structuralObjectClass) },