summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/pblock.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2010-02-08 08:57:52 -0700
committerRich Megginson <rmeggins@redhat.com>2010-02-17 15:04:02 -0700
commit834c706f04e53bb3ca95caa31c6e1166ad79210e (patch)
treee002cfe1db898002465b4545c6b38be39b9d615e /ldap/servers/slapd/pblock.c
parent3e5e21c68afc5ff38d0d843fafaddd145e4d38f5 (diff)
downloadds-834c706f04e53bb3ca95caa31c6e1166ad79210e.tar.gz
ds-834c706f04e53bb3ca95caa31c6e1166ad79210e.tar.xz
ds-834c706f04e53bb3ca95caa31c6e1166ad79210e.zip
Do not use syntax plugins directly for filters, indexing
There were many places in the server code that directly used the syntax plugin for the attribute. If the attribute schema definition specified a matching rule, we must use that matching rule for matching values of that attribute, filtering that attribute, and generating index keys for values of that attribute. New internal and plugin APIs have been added that use the Slapi_Attr* instead of using the syntax plugin directly. The new API will determine which matching rule to apply based on the schema definition.
Diffstat (limited to 'ldap/servers/slapd/pblock.c')
-rw-r--r--ldap/servers/slapd/pblock.c104
1 files changed, 102 insertions, 2 deletions
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index 20ead29a..b5d994ad 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -1094,7 +1094,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
}
(*(IFP *)value) = pblock->pb_plugin->plg_syntax_compare;
break;
- case SLAPI_SYNTAX_SUBSTRLENS:
+ case SLAPI_SYNTAX_SUBSTRLENS: /* aka SLAPI_MR_SUBSTRLENS */
(*(int **)value) = pblock->pb_substrlens;
break;
case SLAPI_PLUGIN_SYNTAX_VALIDATE:
@@ -1376,6 +1376,56 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
(*(unsigned int *) value) = pblock->pb_mr_usage;
break;
+ /* new style matching rule syntax plugin functions */
+ case SLAPI_PLUGIN_MR_FILTER_AVA:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_filter_ava;
+ break;
+ case SLAPI_PLUGIN_MR_FILTER_SUB:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_filter_sub;
+ break;
+ case SLAPI_PLUGIN_MR_VALUES2KEYS:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_values2keys;
+ break;
+ case SLAPI_PLUGIN_MR_ASSERTION2KEYS_AVA:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_assertion2keys_ava;
+ break;
+ case SLAPI_PLUGIN_MR_ASSERTION2KEYS_SUB:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_assertion2keys_sub;
+ break;
+ case SLAPI_PLUGIN_MR_FLAGS:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(int *)value) = pblock->pb_plugin->plg_mr_flags;
+ break;
+ case SLAPI_PLUGIN_MR_NAMES:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(char ***)value) = pblock->pb_plugin->plg_mr_names;
+ break;
+ case SLAPI_PLUGIN_MR_COMPARE:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ (*(IFP *)value) = pblock->pb_plugin->plg_mr_compare;
+ break;
+
/* seq arguments */
case SLAPI_SEQ_TYPE:
(*(int *)value) = pblock->pb_seq_type;
@@ -2371,7 +2421,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
}
pblock->pb_plugin->plg_syntax_compare = (IFP) value;
break;
- case SLAPI_SYNTAX_SUBSTRLENS:
+ case SLAPI_SYNTAX_SUBSTRLENS: /* aka SLAPI_MR_SUBSTRLENS */
pblock->pb_substrlens = (int *) value;
break;
case SLAPI_PLUGIN_SYNTAX_VALIDATE:
@@ -2699,6 +2749,56 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
pblock->pb_mr_usage = *(unsigned int *) value;
break;
+ /* new style matching rule syntax plugin functions */
+ case SLAPI_PLUGIN_MR_FILTER_AVA:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_filter_ava = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_FILTER_SUB:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_filter_sub = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_VALUES2KEYS:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_values2keys = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_ASSERTION2KEYS_AVA:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_assertion2keys_ava = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_ASSERTION2KEYS_SUB:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_assertion2keys_sub = (IFP) value;
+ break;
+ case SLAPI_PLUGIN_MR_FLAGS:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_flags = *((int *) value);
+ break;
+ case SLAPI_PLUGIN_MR_NAMES:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_names = (char **) value;
+ break;
+ case SLAPI_PLUGIN_MR_COMPARE:
+ if ( pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE ) {
+ return( -1 );
+ }
+ pblock->pb_plugin->plg_mr_compare = (IFP) value;
+ break;
+
/* seq arguments */
case SLAPI_SEQ_TYPE:
pblock->pb_seq_type = *((int *)value);