]> git.sur5r.net Git - openldap/commitdiff
Clean up some structuralObject checks to improve readability.
authorKurt Zeilenga <kurt@openldap.org>
Tue, 27 Aug 2002 01:55:09 +0000 (01:55 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 27 Aug 2002 01:55:09 +0000 (01:55 +0000)
Functionality not changed (excepting one error message).

servers/slapd/modify.c
servers/slapd/schema_check.c

index f9d618174774f47d797d3acd4b44ffe481d38e37..d0b81b15c7d37299f1dd783ee0e05ab0b384e33f 100644 (file)
@@ -589,18 +589,17 @@ int slap_mods_opattrs(
                        if( rc != LDAP_SUCCESS ) {
                                return rc;
                        }
-                       if ( tmpval.bv_len ) {
-                               mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
-                               mod->sml_op = mop;
-                               mod->sml_type.bv_val = NULL;
-                               mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
-                               mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
-                               ber_dupbv( &mod->sml_bvalues[0], &tmpval );
-                               mod->sml_bvalues[1].bv_val = NULL;
-                               assert( mod->sml_bvalues[0].bv_val );
-                               *modtail = mod;
-                               modtail = &mod->sml_next;
-                       }
+
+                       mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
+                       mod->sml_op = mop;
+                       mod->sml_type.bv_val = NULL;
+                       mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
+                       mod->sml_bvalues = (BerVarray) ch_malloc( 2 * sizeof( struct berval ) );
+                       ber_dupbv( &mod->sml_bvalues[0], &tmpval );
+                       mod->sml_bvalues[1].bv_val = NULL;
+                       assert( mod->sml_bvalues[0].bv_val );
+                       *modtail = mod;
+                       modtail = &mod->sml_next;
                }
 
                if( SLAP_LASTMOD(be) ) {
index 67d8437eca51b03eb072fa4b240f8d50c8c66612..a6b6b98acc2ebd2947f1abac5d167b9e7dc49ec3 100644 (file)
@@ -177,8 +177,6 @@ entry_schema_check(
        rc = structural_class( aoc->a_vals, &nsc, &oc, text, textbuf, textlen );
        if( rc != LDAP_SUCCESS ) {
                return rc;
-       } else if ( nsc.bv_len == 0 ) {
-               return LDAP_OBJECT_CLASS_VIOLATION;
        }
 
        *text = textbuf;
@@ -541,8 +539,9 @@ int structural_class(
                }
        }
 
-       if( scp )
+       if( scp ) {
                *scp = sc;
+       }
 
        if( sc == NULL ) {
                *text = "no structural object classes provided";
@@ -550,6 +549,12 @@ int structural_class(
        }
 
        *scbv = ocs[scn];
+
+       if( scbv->bv_len ) {
+               *text = "invalid structural object class";
+               return LDAP_OBJECT_CLASS_VIOLATION;
+       }
+
        return LDAP_SUCCESS;
 }