]> git.sur5r.net Git - openldap/commitdiff
Minor cleanup
authorHoward Chu <hyc@openldap.org>
Wed, 2 Jan 2002 23:26:20 +0000 (23:26 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 2 Jan 2002 23:26:20 +0000 (23:26 +0000)
servers/slapd/proto-slap.h
servers/slapd/schema_check.c
servers/slapd/tools/slapadd.c

index ae0ff671011f795295017074d4ab581c8d393e29..ee5cf82ad8ef291dc9af4bb775eb2cebe313a7c3 100644 (file)
@@ -818,6 +818,7 @@ LDAP_SLAPD_F( int ) oc_check_allowed(
 LDAP_SLAPD_F( int ) structural_class(
        BVarray ocs,
        struct berval *scbv,
+       ObjectClass **sc,
        const char **text,
        char *textbuf, size_t textlen );
 
index b72517903a4baf0e43d6039ea72caee6c98f6e8a..681e7cc6500da270ee0a75d40cc10aae13d0e7c7 100644 (file)
@@ -104,7 +104,7 @@ entry_schema_check(
        if( sc == NULL ) {
                snprintf( textbuf, textlen, 
                        "unrecognized structuralObjectClass '%s'",
-                       aoc->a_vals[0].bv_val );
+                       asc->a_vals[0].bv_val );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
@@ -122,7 +122,7 @@ entry_schema_check(
        if( sc->soc_kind != LDAP_SCHEMA_STRUCTURAL ) {
                snprintf( textbuf, textlen, 
                        "structuralObjectClass '%s' is not STRUCTURAL",
-                       aoc->a_vals[0].bv_val );
+                       asc->a_vals[0].bv_val );
 
 #ifdef NEW_LOGGING
                LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
@@ -156,7 +156,7 @@ entry_schema_check(
        assert( aoc->a_vals != NULL );
        assert( aoc->a_vals[0].bv_val != NULL );
 
-       rc = structural_class( aoc->a_vals, &nsc, text, textbuf, textlen );
+       rc = structural_class( aoc->a_vals, &nsc, &oc, text, textbuf, textlen );
        if( rc != LDAP_SUCCESS ) {
                return rc;
        } else if ( nsc.bv_len == 0 ) {
@@ -165,11 +165,10 @@ entry_schema_check(
 
        *text = textbuf;
 
-       oc = oc_bvfind( &nsc );
        if ( oc == NULL ) {
                snprintf( textbuf, textlen, 
                        "unrecognized objectClass '%s'",
-                       aoc->a_vals[i].bv_val );
+                       aoc->a_vals[0].bv_val );
                return LDAP_OBJECT_CLASS_VIOLATION;
 
        } else if ( sc != oc ) {
@@ -448,6 +447,7 @@ int oc_check_allowed(
 int structural_class(
        BVarray ocs,
        struct berval *scbv,
+       ObjectClass **scp,
        const char **text,
        char *textbuf, size_t textlen )
 {
@@ -518,6 +518,9 @@ int structural_class(
                }
        }
 
+       if( scp )
+               *scp = sc;
+
        if( sc == NULL ) {
                *text = "no structural object classes provided";
                return LDAP_OBJECT_CLASS_VIOLATION;
@@ -558,6 +561,6 @@ int mods_structural_class(
                return LDAP_OBJECT_CLASS_VIOLATION;
        }
 
-       return structural_class( ocmod->sml_bvalues, sc,
+       return structural_class( ocmod->sml_bvalues, sc, NULL,
                text, textbuf, textlen );
 }
index 3d4953192310d1b39d88cf44445fd80f23a07856..41b3a36318c1a52c62aed4a80a1beae283fbb9c5 100644 (file)
@@ -113,8 +113,8 @@ main( int argc, char **argv )
                        if( sc == NULL ) {
                                struct berval vals[2];
 
-                               int ret = structural_class(
-                                       oc->a_vals, vals, &text, textbuf, textlen );
+                               int ret = structural_class( oc->a_vals, vals,
+                                       NULL, &text, textbuf, textlen );
 
                                if( vals[0].bv_len == 0 ) {
                                        fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",