From 5bf85e607817dbd6e94571e41d6b8a0b23923d7b Mon Sep 17 00:00:00 2001 From: Thierry bordaz (tbordaz) Date: Feb 25 2014 17:52:07 +0000 Subject: Ticket 47699: Propagate plugin precedence to all registered function types Bug Description: A plugin can define its nsslapd-pluginprecedence (config), that is number that order the plugins in the plugin list. If a plugin register an other plugin (slapi_register_plugin), this number is not preserved in the new plugin and it gets a default plugin precedence value. Fix Description: When registering a plugin (slapi_register_plugin) a plugin identity is provided that contains the original plugin configuration (with its precedence). The fix consist to set (in slapi_register_plugin_ext ) the precedence to the value store in the plugin identity. It is done in slapi_register_plugin_ext because referencial integrity calls directly slapi_register_plugin_ext. https://fedorahosted.org/389/ticket/47699 Reviewed by: Rich Megginson / Mark Reynolds Platforms tested: F17 Flag Day: no Doc impact: no --- diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c index 617909d..b13ecbb 100644 --- a/ldap/servers/slapd/plugin.c +++ b/ldap/servers/slapd/plugin.c @@ -268,6 +268,7 @@ slapi_register_plugin_ext( ) { int ii = 0; + int found_precedence; int rc = 0; Slapi_Entry *e = NULL; char *dn = slapi_ch_smprintf("cn=%s,%s", name, PLUGIN_BASE_DN); @@ -284,7 +285,21 @@ slapi_register_plugin_ext( slapi_entry_attr_set_charptr(e, ATTR_PLUGIN_ENABLED, "off"); slapi_entry_attr_set_charptr(e, ATTR_PLUGIN_INITFN, initsymbol); - slapi_entry_attr_set_int(e, ATTR_PLUGIN_PRECEDENCE, precedence); + /* If the plugin belong to a group, get the precedence from the group */ + found_precedence = precedence; + if ((found_precedence == PLUGIN_DEFAULT_PRECEDENCE) && group_identity) { + struct slapi_componentid * cid = (struct slapi_componentid *) group_identity; + if (cid->sci_plugin && + (cid->sci_plugin->plg_precedence != PLUGIN_DEFAULT_PRECEDENCE)) { + slapi_log_error(SLAPI_LOG_PLUGIN, NULL, + "Plugin precedence (%s) reset to group precedence (%s): %d \n", + name ? name : "", + cid->sci_plugin->plg_name ? cid->sci_plugin->plg_name : "", + cid->sci_plugin->plg_precedence); + found_precedence = cid->sci_plugin->plg_precedence; + } + } + slapi_entry_attr_set_int(e, ATTR_PLUGIN_PRECEDENCE, found_precedence); for (ii = 0; argv && argv[ii]; ++ii) { char argname[64];