summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/entry.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/entry.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/entry.c')
-rw-r--r--ldap/servers/slapd/entry.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 75b14979..00558f72 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -465,10 +465,10 @@ typedef struct _str2entry_attr {
struct valuearrayfast sa_present_values;
struct valuearrayfast sa_deleted_values;
int sa_numdups;
- struct slapdplugin *sa_pi;
value_compare_fn_type sa_comparefn;
Avlnode *sa_vtree;
CSN *sa_attributedeletioncsn;
+ Slapi_Attr sa_attr;
} str2entry_attr;
static void
@@ -479,10 +479,10 @@ entry_attr_init(str2entry_attr *sa, const char *type, int state)
valuearrayfast_init(&sa->sa_present_values,NULL);
valuearrayfast_init(&sa->sa_deleted_values,NULL);
sa->sa_numdups= 0;
- sa->sa_pi= NULL;
sa->sa_comparefn = NULL;
sa->sa_vtree= NULL;
sa->sa_attributedeletioncsn= NULL;
+ slapi_attr_init(&sa->sa_attr, type);
}
/*
@@ -829,18 +829,8 @@ str2entry_dupcheck( const char *dn, char *s, int flags, int read_stateinfo )
if ( check_for_duplicate_values )
{
- if ( slapi_attr_type2plugin( type,(void **)&(attrs[nattrs].sa_pi) ) != 0 )
- {
- LDAPDebug( LDAP_DEBUG_ANY,
- "<= str2entry_dupcheck NULL (slapi_attr_type2plugin)\n",
- 0, 0, 0 );
- slapi_entry_free( e ); e = NULL;
- if (retmalloc) slapi_ch_free_string(&valuecharptr);
- if (freetype) slapi_ch_free_string(&type);
- goto free_and_return;
- }
/* Get the comparison function for later use */
- plugin_call_syntax_get_compare_fn( attrs[nattrs].sa_pi, &(attrs[nattrs].sa_comparefn));
+ attr_get_value_cmp_fn( &attrs[nattrs].sa_attr, &(attrs[nattrs].sa_comparefn));
/*
* If the compare function wasn't available,
* we have to revert to AVL-tree-based dup checking,
@@ -904,9 +894,9 @@ str2entry_dupcheck( const char *dn, char *s, int flags, int read_stateinfo )
if (sa->sa_present_values.num > STR2ENTRY_VALUE_DUPCHECK_THRESHOLD)
{
/* Make the tree from the existing attr values */
- rc= valuetree_add_valuearray( sa->sa_type, sa->sa_pi, sa->sa_present_values.va, &sa->sa_vtree, NULL);
+ rc= valuetree_add_valuearray( &sa->sa_attr, sa->sa_present_values.va, &sa->sa_vtree, NULL);
/* Check if the value already exists, in the tree. */
- rc= valuetree_add_value( sa->sa_type, sa->sa_pi, value, &sa->sa_vtree);
+ rc= valuetree_add_value( &sa->sa_attr, value, &sa->sa_vtree);
fast_dup_check = 0;
}
else
@@ -927,7 +917,7 @@ str2entry_dupcheck( const char *dn, char *s, int flags, int read_stateinfo )
else
{
/* Check if the value already exists, in the tree. */
- rc = valuetree_add_value( sa->sa_type, sa->sa_pi, value, &sa->sa_vtree);
+ rc = valuetree_add_value( &sa->sa_attr, value, &sa->sa_vtree);
}
}
@@ -1078,6 +1068,7 @@ free_and_return:
valuearrayfast_done(&attrs[ i ].sa_present_values);
valuearrayfast_done(&attrs[ i ].sa_deleted_values);
valuetree_free( &attrs[ i ].sa_vtree );
+ attr_done( &attrs[ i ].sa_attr );
}
if (tree_attr_checking)
{