From 7f70a7aad6bd2264c7fc0118287f289d16511764 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Thu, 1 Jul 2010 11:28:47 +0000 Subject: [PATCH] New call to unregister controls registered form overlays --- servers/slapd/backover.c | 30 ++++++++++++++++++++++++++++++ servers/slapd/proto-slap.h | 3 +++ 2 files changed, 33 insertions(+) diff --git a/servers/slapd/backover.c b/servers/slapd/backover.c index 8fff96cbe9..e95b192d0b 100644 --- a/servers/slapd/backover.c +++ b/servers/slapd/backover.c @@ -1088,6 +1088,36 @@ overlay_register_control( BackendDB *be, const char *oid ) return 0; } +#ifdef SLAP_CONFIG_DELETE +void +overlay_unregister_control( BackendDB *be, const char *oid ) +{ + int gotit = 0; + int cid; + + if ( slap_find_control_id( oid, &cid ) == LDAP_CONTROL_NOT_FOUND ) { + return; + } + + if ( SLAP_ISGLOBALOVERLAY( be ) ) { + BackendDB *bd; + + /* remove from all backends... */ + LDAP_STAILQ_FOREACH( bd, &backendDB, be_next ) { + if ( bd == be->bd_self ) { + gotit = 1; + } + + bd->be_ctrls[ cid ] = 0; + } + } + + if ( !gotit ) { + be->bd_self->be_ctrls[ cid ] = 0; + } +} +#endif /* SLAP_CONFIG_DELETE */ + void overlay_destroy_one( BackendDB *be, slap_overinst *on ) { diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index b49181d675..f55d870dcf 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -483,6 +483,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 )); -- 2.39.5