mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#7182 allow for later monitor subsystem registration
Some databases might want to register their subsystems under the dn allocated for them by monitor_register_databas. It requires that the deferred database registration callback be called *before* the subsystem's.
This commit is contained in:
parent
7767a41061
commit
838a7f5138
@ -994,7 +994,7 @@ ldap_back_monitor_db_open( BackendDB *be )
|
||||
mss->mss_open = ldap_back_monitor_conn_init;
|
||||
mss->mss_private = li;
|
||||
|
||||
if ( mbe->register_subsys( mss ) )
|
||||
if ( mbe->register_subsys_late( mss ) )
|
||||
{
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"ldap_back_monitor_db_open: "
|
||||
@ -1009,7 +1009,7 @@ ldap_back_monitor_db_open( BackendDB *be )
|
||||
mss->mss_open = ldap_back_monitor_ops_init;
|
||||
mss->mss_private = li;
|
||||
|
||||
if ( mbe->register_subsys( mss ) )
|
||||
if ( mbe->register_subsys_late( mss ) )
|
||||
{
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"ldap_back_monitor_db_open: "
|
||||
|
@ -290,6 +290,7 @@ typedef struct monitor_extra_t {
|
||||
monitor_subsys_t * (*get_subsys_by_dn)( struct berval *ndn, int sub );
|
||||
|
||||
int (*register_subsys)( monitor_subsys_t *ms );
|
||||
int (*register_subsys_late)( monitor_subsys_t *ms );
|
||||
int (*register_backend)( BackendInfo *bi );
|
||||
int (*register_database)( BackendDB *be, struct berval *ndn_out );
|
||||
int (*register_overlay_info)( slap_overinst *on );
|
||||
|
@ -52,6 +52,7 @@ static const monitor_extra_t monitor_extra = {
|
||||
monitor_back_get_subsys_by_dn,
|
||||
|
||||
monitor_back_register_subsys,
|
||||
monitor_back_register_subsys_late,
|
||||
monitor_back_register_backend,
|
||||
monitor_back_register_database,
|
||||
monitor_back_register_overlay_info,
|
||||
@ -283,6 +284,7 @@ enum {
|
||||
LIMBO_DATABASE,
|
||||
LIMBO_OVERLAY_INFO,
|
||||
LIMBO_OVERLAY,
|
||||
LIMBO_SUBSYS,
|
||||
|
||||
LIMBO_LAST
|
||||
};
|
||||
@ -310,6 +312,46 @@ monitor_back_is_configured( void )
|
||||
return be_monitor != NULL;
|
||||
}
|
||||
|
||||
int
|
||||
monitor_back_register_subsys_late(
|
||||
monitor_subsys_t *ms )
|
||||
{
|
||||
entry_limbo_t **elpp, el = { 0 };
|
||||
monitor_info_t *mi;
|
||||
|
||||
if ( be_monitor == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"monitor_back_register_subsys_late: "
|
||||
"monitor database not configured.\n",
|
||||
0, 0, 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* everyting is ready, can register already */
|
||||
if ( monitor_subsys_is_opened() ) {
|
||||
return monitor_back_register_subsys( ms );
|
||||
}
|
||||
|
||||
mi = ( monitor_info_t * )be_monitor->be_private;
|
||||
|
||||
|
||||
el.el_type = LIMBO_SUBSYS;
|
||||
|
||||
el.el_mss = ms;
|
||||
|
||||
for ( elpp = &mi->mi_entry_limbo;
|
||||
*elpp;
|
||||
elpp = &(*elpp)->el_next )
|
||||
/* go to last */;
|
||||
|
||||
*elpp = (entry_limbo_t *)ch_malloc( sizeof( entry_limbo_t ) );
|
||||
|
||||
el.el_next = NULL;
|
||||
**elpp = el;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
monitor_back_register_backend(
|
||||
BackendInfo *bi )
|
||||
@ -2440,6 +2482,10 @@ monitor_back_db_open(
|
||||
rc = monitor_back_register_overlay( el->el_be, el->el_on, el->el_ndn );
|
||||
break;
|
||||
|
||||
case LIMBO_SUBSYS:
|
||||
rc = monitor_back_register_subsys( el->el_mss );
|
||||
break;
|
||||
|
||||
default:
|
||||
assert( 0 );
|
||||
}
|
||||
|
@ -149,6 +149,9 @@ extern int
|
||||
monitor_back_register_subsys LDAP_P((
|
||||
monitor_subsys_t *ms ));
|
||||
extern int
|
||||
monitor_back_register_subsys_late LDAP_P((
|
||||
monitor_subsys_t *ms ));
|
||||
extern int
|
||||
monitor_back_register_backend LDAP_P((
|
||||
BackendInfo *bi ));
|
||||
extern int
|
||||
|
Loading…
Reference in New Issue
Block a user