ldap/servers/slapd/plugin_mr.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
New commits:
commit 375288632674fced396304f3abf8c9c55b04b6b1
Author: Thierry Bordaz <tbordaz(a)redhat.com>
Date: Fri Feb 5 15:10:42 2016 +0100
Ticket 48270: fail to index an attribute with a specific matching rule
Bug Description:
During index configuration, if a new rule type matching rule is added
(attribute 'nsMatchingRule') it creates an indexer.
If the indexer was not already registered (plugin_mr_bind),
In a first step it tries to find/call, for the specified matching rule, an
indexer_create callback of
all the registered matching rule plugins .
If no indexer_create function exist or match the specified matching rule, then it
tries to find
a registered matching rule plugins that matches the specified matching rule
(plg_mr_names).
The problem occurs in the first step, because it uses 'rc' for intermediate
returned code and
can erronously believe the first step was successful although no indexer_create was
found.
So it skips the second step and no matching rule plugin is found.
Fix Description:
The fix consist to avoid using the 'rc' return code in intermediate
slapi-pblock-get/set
https://fedorahosted.org/389/ticket/48270
Reviewed by: Noriko Hosoi (Thank you sooo much Noriko !!)
Platforms tested: F17
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/plugin_mr.c b/ldap/servers/slapd/plugin_mr.c
index 39639e9..d25fca9 100644
--- a/ldap/servers/slapd/plugin_mr.c
+++ b/ldap/servers/slapd/plugin_mr.c
@@ -170,22 +170,25 @@ slapi_mr_indexer_create (Slapi_PBlock* opb)
for (mrp = get_plugin_list(PLUGIN_LIST_MATCHINGRULE); mrp != NULL; mrp =
mrp->plg_next)
{
IFP indexFn = NULL;
+ IFP indexSvFn = NULL;
Slapi_PBlock pb;
memcpy (&pb, opb, sizeof(Slapi_PBlock));
- if (!(rc = slapi_pblock_set (&pb, SLAPI_PLUGIN, mrp)) &&
- !(rc = slapi_pblock_get (&pb, SLAPI_PLUGIN_MR_INDEXER_CREATE_FN,
&createFn)) &&
- createFn != NULL &&
- !(rc = createFn (&pb)) &&
- ((!(rc = slapi_pblock_get (&pb, SLAPI_PLUGIN_MR_INDEX_FN, &indexFn))
&&
- indexFn != NULL) ||
- (!(rc = slapi_pblock_get (&pb, SLAPI_PLUGIN_MR_INDEX_SV_FN, &indexFn))
&&
- indexFn != NULL)))
- {
- /* Success: this plugin can handle it. */
- memcpy (opb, &pb, sizeof(Slapi_PBlock));
- plugin_mr_bind (oid, mrp); /* for future reference */
- rc = 0; /* success */
- break;
+ slapi_pblock_set(&pb, SLAPI_PLUGIN, mrp);
+ if (slapi_pblock_get(&pb, SLAPI_PLUGIN_MR_INDEXER_CREATE_FN, &createFn)) {
+ /* plugin not a matchingrule type */
+ continue;
+ }
+ if (createFn && !createFn(&pb)) {
+ slapi_pblock_get(&pb, SLAPI_PLUGIN_MR_INDEX_FN, &indexFn);
+ slapi_pblock_get(&pb, SLAPI_PLUGIN_MR_INDEX_SV_FN, &indexSvFn);
+ if (indexFn || indexSvFn) {
+ /* Success: this plugin can handle it. */
+ memcpy(opb, &pb, sizeof (Slapi_PBlock));
+ plugin_mr_bind(oid, mrp); /* for future reference */
+ rc = 0; /* success */
+ break;
+ }
+
}
}
if (rc != 0) {