}
/* make sure the DN is valid */
- if( dn_normalize( e->e_ndn ) == NULL ) {
+ if( dn_normalize( e->e_ndn ) == NULL || e->e_ndn[0] == '\0' ) {
fprintf( stderr, "%s: invalid dn=\"%s\" (line=%d)\n",
progname, e->e_dn, lineno );
rc = EXIT_FAILURE;
}
/* check backend */
- if( select_backend( e->e_ndn ) != be ) {
- fprintf( stderr, "%s: database not configured to "
+ if( select_backend( e->e_ndn, is_entry_referral(e) ) != be )
+ {
+ fprintf( stderr, "%s: database (%s) not configured to "
"hold dn=\"%s\" (line=%d)\n",
- progname, e->e_dn, lineno );
+ progname,
+ be ? be->be_suffix[0] : "<none>",
+ e->e_dn, lineno );
rc = EXIT_FAILURE;
entry_free( e );
if( continuemode ) continue;
break;
}
- if( !noschemacheck ) {
+ if( global_schemacheck ) {
/* check schema */
const char *text;
- if ( entry_schema_check( e, NULL, &text ) != LDAP_SUCCESS ) {
+ char textbuf[SLAP_TEXT_BUFLEN];
+ size_t textlen = sizeof textbuf;
+
+ rc = entry_schema_check( e, NULL, &text, textbuf, textlen );
+
+ if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",
progname, e->e_dn, lineno, text );
rc = EXIT_FAILURE;
}
id = be->be_entry_put( be, e );
-
if( id == NOID ) {
fprintf( stderr, "%s: could not add entry dn=\"%s\" (line=%d)\n",
progname, e->e_dn, lineno );
if( continuemode ) continue;
break;
- } else if ( verbose ) {
+ }
+
+ if ( verbose ) {
fprintf( stderr, "added: \"%s\" (%08lx)\n",
e->e_dn, (long) id );
}