]> git.sur5r.net Git - openldap/commitdiff
more about previous commit
authorPierangelo Masarati <ando@openldap.org>
Thu, 5 Mar 2009 18:25:43 +0000 (18:25 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 5 Mar 2009 18:25:43 +0000 (18:25 +0000)
servers/slapd/slapadd.c

index 5ee5abf08a4c20544e2b6e3b2da6ca6d506227ed..a6cf3a2e219e52c05416564903a6b123b28a546b 100644 (file)
@@ -177,8 +177,26 @@ slapadd( int argc, char **argv )
                if( BER_BVISEMPTY( &e->e_nname ) &&
                        !BER_BVISEMPTY( be->be_nsuffix ))
                {
-                       fprintf( stderr, "%s: empty dn=\"%s\" (line=%d)\n",
-                               progname, e->e_dn, lineno );
+                       fprintf( stderr, "%s: line %d: "
+                               "cannot add entry with empty dn=\"%s\"",
+                               progname, lineno, e->e_dn );
+                       bd = select_backend( &e->e_nname, nosubordinates );
+                       if ( bd ) {
+                               BackendDB *bdtmp;
+                               int dbidx = 0;
+                               LDAP_STAILQ_FOREACH( bdtmp, &backendDB, be_next ) {
+                                       if ( bdtmp == bd ) break;
+                                       dbidx++;
+                               }
+
+                               assert( bdtmp != NULL );
+                               
+                               fprintf( stderr, "; did you mean to use database #%d (%s)?",
+                                       dbidx,
+                                       bd->be_suffix[0].bv_val );
+
+                       }
+                       fprintf( stderr, "\n" );
                        rc = EXIT_FAILURE;
                        entry_free( e );
                        if( continuemode ) continue;