case SLAPCAT:
options = " [-c]\n\t[-g] [-n databasenumber | -b suffix]"
- " [-l ldiffile] [-a filter]\n";
+ " [-l ldiffile] [-a filter] [-s subtree]\n";
break;
case SLAPDN:
char *subtree = NULL;
char *ldiffile = NULL;
char **debug_unknowns = NULL;
- int rc, i, dbnum;
+ int rc, i;
int mode = SLAP_TOOL_MODE;
int truncatemode = 0;
int use_glue = 1;
break;
case 'n': /* which config file db to index */
- if ( lutil_atoi( &dbnum, optarg ) ) {
+ if ( lutil_atoi( &dbnum, optarg ) || dbnum < 0 ) {
usage( tool, progname );
}
break;
}
if ( use_glue ) {
- rc = glue_sub_attach();
+ rc = glue_sub_attach( 0 );
if ( rc != 0 ) {
fprintf( stderr,
progname, dbnum, 0 );
}
- } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
+ } else if ( dbnum >= nbackends ) {
fprintf( stderr,
"Database number selected via -n is out of range\n"
"Must be in the range 0 to %d"
- " (number of configured databases)\n",
- nbackends-1 );
+ " (the number of configured databases)\n",
+ nbackends - 1 );
exit( EXIT_FAILURE );
} else {
}
startup:;
+ if ( be ) {
+ BackendDB *bdtmp;
+
+ dbnum = 0;
+ LDAP_STAILQ_FOREACH( bdtmp, &backendDB, be_next ) {
+ if ( bdtmp == be ) break;
+ dbnum++;
+ }
+ }
#ifdef CSRIMALLOC
mal_leaktrace(1);