ldap/servers/slapd/plugin.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
New commits:
commit 272bd14ee0396d5cb02dd01b2ecbc294b16a8a7f
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Wed Feb 19 17:03:03 2014 +0100
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];