From a8bacbae7878728573fb4b02a2afe24985d8b0ee Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Jan 17 2012 18:12:08 +0000 Subject: Trac Ticket 75 - Unconfigure plugin opperations are being called. https://fedorahosted.org/389/ticket/75 Fix descriptions: When plugin is not enabled, the start function is not called, but the initialization is made and the plugins are registered. This patch calls the initialization/plugin registration only when the plugin is enabled. --- diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c index b211019..f5579c9 100644 --- a/ldap/servers/plugins/usn/usn.c +++ b/ldap/servers/plugins/usn/usn.c @@ -77,18 +77,10 @@ usn_init(Slapi_PBlock *pb) { int rc = 0; void *identity = NULL; - int enabled = 0; slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM, "--> usn_init\n"); - slapi_pblock_get(pb, SLAPI_PLUGIN_ENABLED, &enabled); - - if (!enabled) { - /* not enabled */ - goto bail; - } - slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &identity); /* slapi_register_plugin always returns SUCCESS (0) */ diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c index 52b560f..8179352 100644 --- a/ldap/servers/slapd/plugin.c +++ b/ldap/servers/slapd/plugin.c @@ -2293,7 +2293,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group, slapi_pblock_set(&pb, SLAPI_PLUGIN_ENABLED, &enabled); slapi_pblock_set(&pb, SLAPI_PLUGIN_CONFIG_ENTRY, plugin_entry); - if ((*initfunc)(&pb) != 0) + if (enabled && (*initfunc)(&pb) != 0) { LDAPDebug(LDAP_DEBUG_ANY, "Init function \"%s\" for \"%s\" plugin" " in library \"%s\" failed\n",