Revert prev commit, use -g option to disable glue instead

This commit is contained in:
Howard Chu 2005-10-15 21:52:01 +00:00
parent 10a696bd15
commit 37e58a73a4
3 changed files with 18 additions and 62 deletions

View 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()
{

View 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

View 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:;