]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/tools/slapcommon.c
Added the suffix=<dn> parameter to replica config directive
[openldap] / servers / slapd / tools / slapcommon.c
index dd4095e74a4d52748fdb6dd70878172bbba2080f..9c583c964d28902221c6a5c520ae6fdd6eefb466 100644 (file)
@@ -23,7 +23,6 @@ char  *progname       = NULL;
 char   *conffile       = SLAPD_DEFAULT_CONFIGFILE;
 int            truncatemode = 0;
 int            verbose         = 0;
-int            noschemacheck = 0;
 int            continuemode = 0;
 
 char   *ldiffile       = NULL;
@@ -42,11 +41,11 @@ usage( int tool )
        char *options = NULL;
        fprintf( stderr,
                "usage: %s [-v] [-c] [-d debuglevel] [-f configfile]\n"
-                        "\t[-n databasenumber | -b suffix]", progname );
+                       "\t[-n databasenumber | -b suffix]", progname );
 
        switch( tool ) {
        case SLAPADD:
-               options = "\t[-s] [-l ldiffile]\n";
+               options = "\t[-l ldiffile]\n";
                break;
 
        case SLAPCAT:
@@ -54,7 +53,7 @@ usage( int tool )
                break;
 
        case SLAPINDEX:
-               options = "\tattributetype\n";
+               options = "\n";
                break;
        }
 
@@ -97,7 +96,7 @@ slap_tool_init(
 
        switch( tool ) {
        case SLAPADD:
-               options = "b:cd:f:l:n:stv";
+               options = "b:cd:f:l:n:tv";
                break;
 
        case SLAPINDEX:
@@ -142,10 +141,6 @@ slap_tool_init(
                        dbnum = atoi( optarg ) - 1;
                        break;
 
-               case 's':       /* disable schema checking */
-                       noschemacheck++;
-                       break;
-
                case 't':       /* turn on truncate */
                        truncatemode++;
                        mode |= SLAP_TRUNCATE_MODE;
@@ -161,9 +156,7 @@ slap_tool_init(
                }
        }
 
-       if ( ( argc != optind + (tool == SLAPINDEX ? 1 : 0) )
-               || (dbnum >= 0 && base != NULL ) )
-       {
+       if ( ( argc != optind ) || (dbnum >= 0 && base != NULL ) ) {
                usage( tool );
        }
 
@@ -188,6 +181,13 @@ slap_tool_init(
                exit( EXIT_FAILURE );
        }
 
+       rc = schema_init();
+
+       if (rc != 0 ) {
+               fprintf( stderr, "%s: slap_schema_init failed!\n", progname );
+               exit( EXIT_FAILURE );
+       }
+
        read_config( conffile );
 
        if ( !nbackends ) {
@@ -195,6 +195,13 @@ slap_tool_init(
                exit( EXIT_FAILURE );
        }
 
+       rc = schema_prep();
+
+       if (rc != 0 ) {
+               fprintf( stderr, "%s: slap_schema_prep failed!\n", progname );
+               exit( EXIT_FAILURE );
+       }
+
        if( base != NULL ) {
                char *tbase = ch_strdup( base );
 
@@ -204,7 +211,7 @@ slap_tool_init(
                        exit( EXIT_FAILURE );
                }
 
-               be = select_backend( tbase );
+               be = select_backend( tbase, 0 );
                free( tbase );
 
                if( be == NULL ) {