]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapcommon.c
Multi-threaded slapindex
[openldap] / servers / slapd / slapcommon.c
index c6418c9142dab31c8ea1fe5238c7eb1c3843158d..0cf108c72c0afb49d940983db44d4f7ee224b363 100644 (file)
@@ -62,7 +62,7 @@ usage( int tool, const char *progname )
                break;
 
        case SLAPADD:
-               options = " [-c]\n\t[-n databasenumber | -b suffix]\n"
+               options = " [-c]\n\t[-g] [-n databasenumber | -b suffix]\n"
                        "\t[-l ldiffile] [-q] [-u] [-w]\n";
                break;
 
@@ -71,7 +71,7 @@ usage( int tool, const char *progname )
                break;
 
        case SLAPCAT:
-               options = " [-c]\n\t[-n databasenumber | -b suffix]"
+               options = " [-c]\n\t[-g] [-n databasenumber | -b suffix]"
                        " [-l ldiffile] [-a filter]\n";
                break;
 
@@ -80,7 +80,7 @@ usage( int tool, const char *progname )
                break;
 
        case SLAPINDEX:
-               options = " [-c]\n\t[-n databasenumber | -b suffix] [-q]\n";
+               options = " [-c]\n\t[-g] [-n databasenumber | -b suffix] [-q]\n";
                break;
 
        case SLAPTEST:
@@ -178,6 +178,7 @@ slap_tool_init(
        int rc, i, dbnum;
        int mode = SLAP_TOOL_MODE;
        int truncatemode = 0;
+       int use_glue = 1;
 
 #ifdef CSRIMALLOC
        leakfilename = malloc( strlen( progname ) + STRLENOF( ".leak" ) + 1 );
@@ -190,11 +191,11 @@ slap_tool_init(
 
        switch( tool ) {
        case SLAPADD:
-               options = "b:cd:f:F:l:n:qtuvw";
+               options = "b:cd:f:F:gl:n:qtuvw";
                break;
 
        case SLAPCAT:
-               options = "a:b:cd:f:F:l:n:s:v";
+               options = "a:b:cd:f:F:gl:n:s:v";
                mode |= SLAP_TOOL_READMAIN | SLAP_TOOL_READONLY;
                break;
 
@@ -214,7 +215,7 @@ slap_tool_init(
                break;
 
        case SLAPINDEX:
-               options = "b:cd:f:F:n:qv";
+               options = "b:cd:f:F:gn:qv";
                mode |= SLAP_TOOL_READMAIN;
                break;
 
@@ -259,6 +260,10 @@ slap_tool_init(
                        confdir = strdup( optarg );
                        break;
 
+               case 'g':       /* disable subordinate glue */
+                       use_glue = 0;
+                       break;
+
                case 'l':       /* LDIF file */
                        ldiffile = strdup( optarg );
                        break;
@@ -393,44 +398,12 @@ slap_tool_init(
         * initialize stuff and figure out which backend we're dealing with
         */
 
-#ifdef SLAPD_MODULES
-       if ( module_init() != 0 ) {
-               fprintf( stderr, "%s: module_init failed!\n", progname );
-               exit( EXIT_FAILURE );
-       }
-#endif
-               
-       rc = slap_schema_init();
-
-       if ( rc != 0 ) {
-               fprintf( stderr, "%s: slap_schema_init failed!\n", progname );
-               exit( EXIT_FAILURE );
-       }
-
        rc = slap_init( mode, progname );
-
        if ( rc != 0 ) {
                fprintf( stderr, "%s: slap_init failed!\n", progname );
                exit( EXIT_FAILURE );
        }
 
-       if ( frontend_init() ) {
-               fprintf( stderr, "%s: frontend_init failed!\n", progname );
-               exit( EXIT_FAILURE );
-       }
-
-       if ( overlay_init() ) {
-               fprintf( stderr, "%s: overlay_init failed!\n", progname );
-               exit( EXIT_FAILURE );
-       }
-
-#ifdef SLAP_DYNACL
-       if ( acl_init() ) {
-               fprintf( stderr, "%s: acl_init failed!\n", progname );
-               exit( EXIT_FAILURE );
-       }
-#endif /* SLAP_DYNACL */
-
        rc = read_config( conffile, confdir );
 
        if ( rc != 0 ) {
@@ -456,6 +429,16 @@ slap_tool_init(
                break;
        }
 
+       if ( use_glue ) {
+               rc = glue_sub_attach();
+
+               if ( rc != 0 ) {
+                       fprintf( stderr,
+                               "%s: subordinate configuration error\n", progname );
+                       exit( EXIT_FAILURE );
+               }
+       }
+
        rc = slap_schema_check();
 
        if ( rc != 0 ) {