mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-12 10:54:48 +08:00
ITS#4089 use slapcat -n XX to specify just the superior of a glued tree
This commit is contained in:
parent
bd5706d8e5
commit
10a696bd15
@ -919,6 +919,51 @@ 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()
|
||||
{
|
||||
|
@ -404,6 +404,7 @@ 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
|
||||
|
@ -560,6 +560,12 @@ 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:;
|
||||
|
Loading…
Reference in New Issue
Block a user