From b2e776cfe7ced6201e8631f86d59d1f819cb3e19 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 16 Sep 2000 06:23:53 +0000 Subject: [PATCH] Reorder DN check --- servers/slapd/tools/slapadd.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/servers/slapd/tools/slapadd.c b/servers/slapd/tools/slapadd.c index 4cf22f2457..ab8f06c01a 100644 --- a/servers/slapd/tools/slapadd.c +++ b/servers/slapd/tools/slapadd.c @@ -59,7 +59,7 @@ main( int argc, char **argv ) /* make sure the DN is valid */ if( dn_normalize( e->e_ndn ) == NULL ) { - fprintf( stderr, "%s: bad dn=\"%s\" (line=%d)\n", + fprintf( stderr, "%s: invalid dn=\"%s\" (line=%d)\n", progname, e->e_dn, lineno ); rc = EXIT_FAILURE; entry_free( e ); @@ -67,7 +67,7 @@ main( int argc, char **argv ) break; } - /* make sure the DN is valid */ + /* make sure the DN is not empty */ if( e->e_ndn == '\0' ) { fprintf( stderr, "%s: empty dn=\"%s\" (line=%d)\n", progname, e->e_dn, lineno ); @@ -77,6 +77,17 @@ main( int argc, char **argv ) break; } + /* check backend */ + if( select_backend( e->e_ndn ) != be ) { + fprintf( stderr, "%s: database not configured to " + "hold dn=\"%s\" (line=%d)\n", + progname, e->e_dn, lineno ); + rc = EXIT_FAILURE; + entry_free( e ); + if( continuemode ) continue; + break; + } + if( !noschemacheck ) { /* check schema */ const char *text; @@ -88,16 +99,6 @@ main( int argc, char **argv ) if( continuemode ) continue; break; } - - /* check backend */ - if( select_backend( e->e_ndn ) != be ) { - fprintf( stderr, "%s: database not configured to hold dn=\"%s\" (line=%d)\n", - progname, e->e_dn, lineno ); - rc = EXIT_FAILURE; - entry_free( e ); - if( continuemode ) continue; - break; - } } id = be->be_entry_put( be, e ); -- 2.39.5