Ticket 48746: Crash when indexing an attribute with a matching rule
Bug Description:
When creating a mr_indexer, we first look at the registered MR (global_mr_oids).
If the indexer is not registered or have no indexer create function, we try
- to find a plugin (possibly a custom one) that could provide such indexer create.
- use a default indexer
The problem is that going through the matching rule plugins, we pick the first one with
an indexer even if it applies to a different syntax.
For example, searching for an caseExactIA5Match MR plugin we select caseIgnoreIA5Match because
it appears first in the plugins list.
The consequence is that we may index with the wrong index function (and trigger
https://fedorahosted.org/389/ticket/48745) and picking a wrong indexer_create (or filter_create)
function the MR private in the pblock (SLAPI_PLUGIN_OBJECT) can be NULL
(https://fedorahosted.org/389/ticket/48746).
Also we can imagine an incorrect custom MR plugin that forgets to set this MR private object
and could trigger a crash. So use of MR private object should check if it was set.
Fix Description:
The fix is:
slapi_mr_indexer_create:
plugin_mr_filter_create:
If there is no register MR for a specific oid, we search a plugin
that can handle that oid (plugin_mr_find).
mr_wrap_mr_index_sv_fn:
mr_wrap_mr_index_fn:
default_mr_filter_match:
default_mr_filter_index:
hardening if a custom plugin index_create function did not set SLAPI_PLUGIN_OBJECT
https://fedorahosted.org/389/ticket/48746
Reviewed by: Rich Megginson (thanks Rich for all help/feedback and the review)
Platforms tested: F17
Flag Day: no
Doc impact: no