openldap2/0011-config-delete-overlay-fixes.dif

111 lines
3.6 KiB
Plaintext
Raw Normal View History

From 0ca1fbc64f2f02cbdff0827e4ca1bbe312bebc2f Mon Sep 17 00:00:00 2001
From: Ralf Haferkamp <rhafer@suse.de>
Date: Fri, 22 Jan 2010 11:18:46 +0100
Subject: config-delete overlay fixes
- unregister controls when removing overlays from cn=config (syncprov,
ppolicy, valsort, chain and sssvlv)
- Send error to active psearches upon syncprov overlay removal
- syncprov: reset BackendInfo to original value after checkpoint. Leaks memory
otherwise (with -DSLAP_CONFIG_DELETE)
bnc#548773
diff --git a/servers/slapd/back-ldap/chain.c b/servers/slapd/back-ldap/chain.c
index 41bb6ef..8f37efb 100644
--- a/servers/slapd/back-ldap/chain.c
+++ b/servers/slapd/back-ldap/chain.c
@@ -1979,6 +1979,11 @@ ldap_chain_db_close(
BackendDB *be,
ConfigReply *cr )
{
+#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
+#ifdef SLAP_CONFIG_DELETE
+ overlay_unregister_control( be, LDAP_CONTROL_X_CHAINING_BEHAVIOR );
+#endif /* SLAP_CONFIG_DELETE */
+#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
return ldap_chain_db_func( be, db_close );
}
diff --git a/servers/slapd/overlays/ppolicy.c b/servers/slapd/overlays/ppolicy.c
index 43cc345..048bf89 100644
--- a/servers/slapd/overlays/ppolicy.c
+++ b/servers/slapd/overlays/ppolicy.c
@@ -2308,6 +2308,11 @@ ppolicy_close(
slap_overinst *on = (slap_overinst *) be->bd_info;
pp_info *pi = on->on_bi.bi_private;
+
+#ifdef SLAP_CONFIG_DELETE
+ overlay_unregister_control( be, LDAP_CONTROL_PASSWORDPOLICYREQUEST );
+#endif /* SLAP_CONFIG_DELETE */
+
/* Perhaps backover should provide bi_destroy hooks... */
ov_count--;
if ( ov_count <=0 && pwcons ) {
diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c
index 1100de7..814f95e 100644
--- a/servers/slapd/overlays/syncprov.c
+++ b/servers/slapd/overlays/syncprov.c
@@ -3143,6 +3143,7 @@ syncprov_db_close(
{
slap_overinst *on = (slap_overinst *) be->bd_info;
syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
+ syncops *so, *sonext;
if ( slapMode & SLAP_TOOL_MODE ) {
return 0;
@@ -3162,6 +3163,20 @@ syncprov_db_close(
syncprov_checkpoint( op, on );
}
+#ifdef SLAP_CONFIG_DELETE
+ ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
+ for ( so=si->si_ops, sonext=so; so; so=sonext ) {
+ SlapReply rs = {REP_RESULT};
+ rs.sr_err = LDAP_UNAVAILABLE;
+ send_ldap_result( so->s_op, &rs );
+ sonext=so->s_next;
+ syncprov_drop_psearch( so, 0);
+ }
+ si->si_ops=NULL;
+ ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
+ overlay_unregister_control( be, LDAP_CONTROL_SYNC );
+#endif /* SLAP_CONFIG_DELETE */
+
return 0;
}
diff --git a/servers/slapd/overlays/valsort.c b/servers/slapd/overlays/valsort.c
index 80d9382..033cbf6 100644
--- a/servers/slapd/overlays/valsort.c
+++ b/servers/slapd/overlays/valsort.c
@@ -490,6 +490,10 @@ valsort_destroy(
slap_overinst *on = (slap_overinst *)be->bd_info;
valsort_info *vi = on->on_bi.bi_private, *next;
+#ifdef SLAP_CONFIG_DELETE
+ overlay_unregister_control( be, LDAP_CONTROL_VALSORT );
+#endif /* SLAP_CONFIG_DELETE */
+
for (; vi; vi = next) {
next = vi->vi_next;
ch_free( vi->vi_dn.bv_val );
diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h
index 1aebece..bb0dd63 100644
--- a/servers/slapd/proto-slap.h
+++ b/servers/slapd/proto-slap.h
@@ -484,6 +484,9 @@ LDAP_SLAPD_F (void) overlay_move LDAP_P((
#ifdef SLAP_CONFIG_DELETE
LDAP_SLAPD_F (void) overlay_remove LDAP_P((
BackendDB *be, slap_overinst *on ));
+LDAP_SLAPD_F (void) overlay_unregister_control LDAP_P((
+ BackendDB *be,
+ const char *oid ));
#endif /* SLAP_CONFIG_DELETE */
LDAP_SLAPD_F (int) overlay_callback_after_backover LDAP_P((
Operation *op, slap_callback *sc, int append ));
--
1.7.3.4