]> git.sur5r.net Git - openldap/commitdiff
Revert prev commit, use -g option to disable glue instead
authorHoward Chu <hyc@openldap.org>
Sat, 15 Oct 2005 21:52:01 +0000 (21:52 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 15 Oct 2005 21:52:01 +0000 (21:52 +0000)
servers/slapd/backglue.c
servers/slapd/proto-slap.h
servers/slapd/slapcommon.c

index 71a1884dfe7cd289b501c033bee99bd4df167e1e..bc17618b36bf29a0f08acab01865199ae424380a 100644 (file)
@@ -919,51 +919,6 @@ glue_sub_add( BackendDB *be, int advert, int online )
        return rc;
 }
 
-/* Detach all glued subordinates from the superior. Only
- * called in tool mode.
- */
-void
-glue_sub_detach( BackendDB *be )
-{
-       slap_overinfo *oi = (slap_overinfo *)be->bd_info;
-       slap_overinst *on, **oprev;
-
-       /* If glue is the only overlay, just remove the overlay framework */
-       if ( oi->oi_list->on_bi.bi_type == glue.on_bi.bi_type &&
-               oi->oi_list->on_next == NULL ) {
-               /* We don't do any cleanup. Doesn't matter in tool mode. */
-               be->bd_info = oi->oi_orig;
-               return;
-       }
-
-       /* There are multiple overlays, just drop ours from the list */
-       for ( on=oi->oi_list, oprev = &oi->oi_list; on; on=on->on_next ) {
-               if ( on->on_bi.bi_type == glue.on_bi.bi_type ) {
-                       *oprev = on->on_next;
-                       break;
-               }
-               oprev = &on->on_next;
-
-               /* Undo the glue_db_init() changes in oi */
-               oi->oi_bi.bi_open = oi->oi_orig->bi_open;
-               oi->oi_bi.bi_close = oi->oi_orig->bi_close;
-
-               oi->oi_bi.bi_entry_release_rw = oi->oi_orig->bi_entry_release_rw;
-
-               oi->oi_bi.bi_tool_entry_open = oi->oi_orig->bi_tool_entry_open;
-               oi->oi_bi.bi_tool_entry_close = oi->oi_orig->bi_tool_entry_close;
-               oi->oi_bi.bi_tool_entry_first = oi->oi_orig->bi_tool_entry_first;
-               oi->oi_bi.bi_tool_entry_get = oi->oi_orig->bi_tool_entry_get;
-               oi->oi_bi.bi_tool_entry_put = oi->oi_orig->bi_tool_entry_put;
-               oi->oi_bi.bi_tool_entry_reindex = oi->oi_orig->bi_tool_entry_reindex;
-               oi->oi_bi.bi_tool_sync = oi->oi_orig->bi_tool_sync;
-               oi->oi_bi.bi_tool_dn2id_get = oi->oi_orig->bi_tool_dn2id_get;
-               oi->oi_bi.bi_tool_id2entry_get = oi->oi_orig->bi_tool_id2entry_get;
-               oi->oi_bi.bi_tool_entry_modify = oi->oi_orig->bi_tool_entry_modify;
-       }
-       return;
-}
-
 int
 glue_sub_init()
 {
index 41fed652947a053043df5d1ef913ce1cf0e1996e..d9c0ab24364788408a9ac528d5aa7687f2c5b58e 100644 (file)
@@ -404,7 +404,6 @@ LDAP_SLAPD_F (int) glue_sub_init( void );
 LDAP_SLAPD_F (int) glue_sub_attach( void );
 LDAP_SLAPD_F (int) glue_sub_add( BackendDB *be, int advert, int online );
 LDAP_SLAPD_F (int) glue_sub_del( BackendDB *be );
-LDAP_SLAPD_F (void) glue_sub_detach( BackendDB *be );
 
 /*
  * backover.c
index ddec1a2447fc29c53454fa16e858231f0bb04f6a..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;
@@ -424,11 +429,14 @@ slap_tool_init(
                break;
        }
 
-       rc = glue_sub_attach();
+       if ( use_glue ) {
+               rc = glue_sub_attach();
 
-       if ( rc != 0 ) {
-               fprintf( stderr, "%s: subordinate configuration error\n", progname );
-               exit( EXIT_FAILURE );
+               if ( rc != 0 ) {
+                       fprintf( stderr,
+                               "%s: subordinate configuration error\n", progname );
+                       exit( EXIT_FAILURE );
+               }
        }
 
        rc = slap_schema_check();
@@ -560,12 +568,6 @@ slap_tool_init(
                        if ( dbnum == 0 ) break;
                        dbnum--;
                }
-               /* If a glued database is specified by number, just operate
-                * on the single database.
-                */
-               if ( SLAP_GLUE_INSTANCE( be ) ) {
-                       glue_sub_detach( be );
-               }
        }
 
 startup:;