From f230d32cbb92d87ab4436410bf23acda5fc890fa Mon Sep 17 00:00:00 2001 From: Thierry Bordaz Date: Mar 07 2016 16:44:35 +0000 Subject: ticket: 48497 extended search without MR indexed attribute prevents later indexing with that MR Bug Description: When creating a mr_indexer or a mr_filter, we first look if it exists the registered MR (global_mr_oids) that can handle the required oid. If there is no registered MR, we look for a MR plugin that can handle this oid. At the beginning no MR is registered. If the retrieved MR plugin is called to create: - an indexer it sets in the registered MR the indexer create function(SLAPI_PLUGIN_MR_INDEXER_CREATE_FN) but not the filter create function (SLAPI_PLUGIN_MR_FILTER_CREATE_FN). - a filter it sets in the registered MR the filter create function (SLAPI_PLUGIN_MR_FILTER_CREATE_FN) but not SLAPI_PLUGIN_MR_INDEXER_CREATE_FN. The consequence is that the registered MR may be missing filter or indexer create fn. It ends with different wrong behaviors: 1 - for example if we index (e.g. msMatchingRule: caseExactIA5Match) it registers 'caseExactIA5Match', MR plugin with the indexer create function. Then if we issue a filter with ": caseExactIA5Match:' it will not find the registered MR (because it is missing SLAPI_PLUGIN_MR_FILTER_CREATE_FN), so it will register once again the same MR plugin but this time with the filter create function. 2 - for example if we issue a filter with ": caseExactIA5Match:' it registers 'caseExactIA5Match', MR plugin with the filter create function. Then if we index 'msMatchingRule: caseExactIA5Match', it will retrieve the registered MR plugin but has it has no indexer create function, it fails to index. Fix Description: When registering a MR plugin, sets both indexer and filter create functions https://fedorahosted.org/389/ticket/48746 Reviewed by: Mark Reynolds, Rich Megginson (thanks Mark, thanks Rich !!) 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 d25fca9..2ff63a6 100644 --- a/ldap/servers/slapd/plugin_mr.c +++ b/ldap/servers/slapd/plugin_mr.c @@ -569,6 +569,7 @@ plugin_mr_filter_create (mr_filter_t* f) pblock_init(&pb); slapi_pblock_set(&pb, SLAPI_PLUGIN, mrp); slapi_pblock_set(&pb, SLAPI_PLUGIN_MR_FILTER_CREATE_FN, default_mr_filter_create); + slapi_pblock_set(&pb, SLAPI_PLUGIN_MR_INDEXER_CREATE_FN, default_mr_indexer_create); if (!(rc = attempt_mr_filter_create (f, mrp, &pb))) { plugin_mr_bind (f->mrf_oid, mrp); /* for future reference */ @@ -639,6 +640,7 @@ default_mr_indexer_create(Slapi_PBlock* pb) slapi_pblock_set(pb, SLAPI_PLUGIN_MR_INDEX_SV_FN, mr_wrap_mr_index_sv_fn); slapi_pblock_set(pb, SLAPI_PLUGIN_DESTROY_FN, default_mr_indexer_destroy); slapi_pblock_set(pb, SLAPI_PLUGIN_MR_INDEXER_CREATE_FN, default_mr_indexer_create); + slapi_pblock_set(pb, SLAPI_PLUGIN_MR_FILTER_CREATE_FN, default_mr_filter_create); rc = 0; done: