From: Howard Chu Date: Sat, 15 Oct 2005 21:52:01 +0000 (+0000) Subject: Revert prev commit, use -g option to disable glue instead X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~232 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=37e58a73a4bf2cb7ce6a8d54097b54f0f28aefec;p=openldap Revert prev commit, use -g option to disable glue instead --- diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 71a1884dfe..bc17618b36 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -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() { diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 41fed65294..d9c0ab2436 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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 diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c index ddec1a2447..0cf108c72c 100644 --- a/servers/slapd/slapcommon.c +++ b/servers/slapd/slapcommon.c @@ -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:;