return 0;
}
-void backend_destroy_one( BackendDB *bd, int dynamic )
+/*
+ * This function is supposed to be the exact counterpart
+ * of backend_startup_one(), although this one calls bi_db_destroy()
+ * while backend_startup_one() calls bi_db_open().
+ *
+ * Make sure backend_stopdown_one() destroys resources allocated
+ * by backend_startup_one(); only call backend_destroy_one() when
+ * all stuff in a BackendDB needs to be destroyed
+ */
+void
+backend_stopdown_one( BackendDB *bd )
{
- if ( dynamic ) {
- LDAP_STAILQ_REMOVE(&backendDB, bd, slap_backend_db, be_next );
- }
-
- if ( bd->be_syncinfo ) {
- syncinfo_free( bd->be_syncinfo );
- }
-
if ( bd->be_pending_csn_list ) {
struct slap_csn_entry *csne;
csne = LDAP_TAILQ_FIRST( bd->be_pending_csn_list );
if ( bd->bd_info->bi_db_destroy ) {
bd->bd_info->bi_db_destroy( bd );
}
+}
+
+void backend_destroy_one( BackendDB *bd, int dynamic )
+{
+ if ( dynamic ) {
+ LDAP_STAILQ_REMOVE(&backendDB, bd, slap_backend_db, be_next );
+ }
+
+ if ( bd->be_syncinfo ) {
+ syncinfo_free( bd->be_syncinfo );
+ }
+
+ backend_stopdown_one( bd );
+
ber_bvarray_free( bd->be_suffix );
ber_bvarray_free( bd->be_nsuffix );
if ( !BER_BVISNULL( &bd->be_rootdn ) ) {
cache_manager *cm = on->on_bi.bi_private;
query_manager *qm = cm->qm;
- /* cleanup stuff inherited from the original database... */
- cm->db.be_suffix = NULL;
- cm->db.be_nsuffix = NULL;
- BER_BVZERO( &cm->db.be_rootdn );
- BER_BVZERO( &cm->db.be_rootndn );
- BER_BVZERO( &cm->db.be_rootpw );
- /* FIXME: there might be more... */
-
if ( cm->db.be_private != NULL ) {
- backend_destroy_one( &cm->db, 0 );
+ backend_stopdown_one( &cm->db );
}
ldap_pvt_thread_mutex_destroy( &qm->lru_mutex );
Debug(LDAP_DEBUG_TRACE, "==> translucent_db_close\n", 0, 0, 0);
if ( ov ) {
- /* cleanup stuff inherited from the original database... */
- ov->db.be_suffix = NULL;
- ov->db.be_nsuffix = NULL;
- BER_BVZERO( &ov->db.be_rootdn );
- BER_BVZERO( &ov->db.be_rootndn );
- BER_BVZERO( &ov->db.be_rootpw );
- /* FIXME: there might be more... */
-
if ( ov->db.be_private != NULL ) {
- backend_destroy_one( &ov->db, 0 );
+ backend_stopdown_one( &ov->db );
}
ch_free(ov);
LDAP_SLAPD_F (int) backend_sync LDAP_P((Backend *be));
LDAP_SLAPD_F (int) backend_shutdown LDAP_P((Backend *be));
LDAP_SLAPD_F (int) backend_destroy LDAP_P((void));
+LDAP_SLAPD_F (void) backend_stopdown_one LDAP_P((BackendDB *bd ));
LDAP_SLAPD_F (void) backend_destroy_one LDAP_P((BackendDB *bd, int dynamic));
LDAP_SLAPD_F (BackendInfo *) backend_info LDAP_P(( const char *type ));