diff --git a/servers/slapd/schema_check.c b/servers/slapd/schema_check.c index 4a57356be7..b53cd45353 100644 --- a/servers/slapd/schema_check.c +++ b/servers/slapd/schema_check.c @@ -550,7 +550,7 @@ int structural_class( *scbv = ocs[scn]; - if( scbv->bv_len ) { + if( scbv->bv_len == 0 ) { *text = "invalid structural object class"; return LDAP_OBJECT_CLASS_VIOLATION; } diff --git a/servers/slapd/tools/slapadd.c b/servers/slapd/tools/slapadd.c index aeede043bb..e993da5fa8 100644 --- a/servers/slapd/tools/slapadd.c +++ b/servers/slapd/tools/slapadd.c @@ -119,13 +119,12 @@ main( int argc, char **argv ) if( sc == NULL ) { struct berval vals[2]; - /* int ret = */ - structural_class( oc->a_vals, vals, + rc = 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", - progname, e->e_dn, lineno, text ); + if( rc != LDAP_SUCCESS ) { + fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n", + progname, e->e_dn, lineno, rc, text ); rc = EXIT_FAILURE; entry_free( e ); if( continuemode ) continue; @@ -141,8 +140,8 @@ main( int argc, char **argv ) rc = entry_schema_check( be, e, NULL, &text, textbuf, textlen ); if( rc != LDAP_SUCCESS ) { - fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n", - progname, e->e_dn, lineno, text ); + fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n", + progname, e->e_dn, lineno, rc, text ); rc = EXIT_FAILURE; entry_free( e ); if( continuemode ) continue;