summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/back-ldbm
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/back-ldbm
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/back-ldbm')
-rw-r--r--ldap/servers/slapd/back-ldbm/back-ldbm.h4
-rw-r--r--ldap/servers/slapd/back-ldbm/filterindex.c76
-rw-r--r--ldap/servers/slapd/back-ldbm/index.c20
-rw-r--r--ldap/servers/slapd/back-ldbm/ldbm_attr.c19
-rw-r--r--ldap/servers/slapd/back-ldbm/ldif2ldbm.c2
-rw-r--r--ldap/servers/slapd/back-ldbm/proto-back-ldbm.h3
-rw-r--r--ldap/servers/slapd/back-ldbm/sort.c8
-rw-r--r--ldap/servers/slapd/back-ldbm/vlv.c22
-rw-r--r--ldap/servers/slapd/back-ldbm/vlv_srch.c4
-rw-r--r--ldap/servers/slapd/back-ldbm/vlv_srch.h3
10 files changed, 79 insertions, 82 deletions
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
index 06cabf2c..1153ff37 100644
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
@@ -467,7 +467,6 @@ struct attrinfo {
* yet. */
#define IS_INDEXED( a ) ( a & INDEX_ANY )
- void *ai_plugin; /* the syntax plugin for this attribute */
char **ai_index_rules; /* matching rule OIDs */
void *ai_dblayer; /* private data used by the dblayer code */
PRInt32 ai_dblayer_count; /* used by the dblayer code */
@@ -475,7 +474,7 @@ struct attrinfo {
attrcrypt_private *ai_attrcrypt; /* private data used by the attribute encryption code (eg is it enabled or not) */
value_compare_fn_type ai_key_cmp_fn; /* function used to compare two index keys -
The function is the compare function provided by
- ai_plugin - this function is used to order
+ attr_get_value_cmp_fn - this function is used to order
the keys in the index so that we can use ORDERING
searches. In order for this function to be used,
the syntax plugin must define a compare function,
@@ -495,6 +494,7 @@ struct attrinfo {
* len value(s) are stored here. If not specified,
* the default length triplet is 2, 3, 2.
*/
+ Slapi_Attr ai_sattr; /* interface to syntax and matching rule plugins */
};
#define MAXDBCACHE 20
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index d41829f8..b77103b6 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -61,7 +61,8 @@ static IDList * range_candidates(
char *type,
struct berval *low_val,
struct berval *high_val,
- int *err
+ int *err,
+ const Slapi_Attr *sattr
);
static IDList *
keys2idl(
@@ -194,8 +195,8 @@ ava_candidates(
struct berval *bval;
Slapi_Value **ivals;
IDList *idl;
- void *pi;
int unindexed = 0;
+ Slapi_Attr sattr;
LDAPDebug( LDAP_DEBUG_TRACE, "=> ava_candidates\n", 0, 0, 0 );
@@ -205,6 +206,8 @@ ava_candidates(
return( NULL );
}
+ slapi_attr_init(&sattr, type);
+
#ifdef LDAP_DEBUG
if ( LDAPDebugLevelIsSet( LDAP_DEBUG_TRACE )) {
char *op = NULL;
@@ -231,15 +234,17 @@ ava_candidates(
switch ( ftype ) {
case LDAP_FILTER_GE:
- idl = range_candidates(pb, be, type, bval, NULL, err);
+ idl = range_candidates(pb, be, type, bval, NULL, err, &sattr);
LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
- return( idl );
+ goto done;
+ break;
case LDAP_FILTER_LE:
- idl = range_candidates(pb, be, type, NULL, bval, err);
+ idl = range_candidates(pb, be, type, NULL, bval, err, &sattr);
LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
- return( idl );
+ goto done;
+ break;
case LDAP_FILTER_EQUALITY:
indextype = (char*)indextype_EQUALITY;
break;
@@ -248,15 +253,6 @@ ava_candidates(
break;
}
- /*
- * get the keys corresponding to this assertion value
- */
- if ( slapi_attr_type2plugin( type, &pi ) != 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE, " slapi_filter_get_ava no plugin\n",
- 0, 0, 0 );
- return( NULL );
- }
-
/* This code is result of performance anlysis; we are trying to
* optimize our equality filter processing -- mainly by limiting
* malloc/free calls.
@@ -282,7 +278,7 @@ ava_candidates(
ptr[1]=NULL;
ivals=ptr;
- slapi_call_syntax_assertion2keys_ava_sv( pi, &tmp, (Slapi_Value ***)&ivals, LDAP_FILTER_EQUALITY_FAST);
+ slapi_attr_assertion2keys_ava_sv( &sattr, &tmp, (Slapi_Value ***)&ivals, LDAP_FILTER_EQUALITY_FAST);
idl = keys2idl( be, type, indextype, ivals, err, &unindexed );
if ( unindexed ) {
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
@@ -306,12 +302,13 @@ ava_candidates(
} else {
slapi_value_init_berval(&sv, bval);
ivals=NULL;
- slapi_call_syntax_assertion2keys_ava_sv( pi, &sv, &ivals, ftype );
+ slapi_attr_assertion2keys_ava_sv( &sattr, &sv, &ivals, ftype );
value_done(&sv);
if ( ivals == NULL || *ivals == NULL ) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= ava_candidates ALLIDS (no keys)\n", 0, 0, 0 );
- return( idl_allids( be ) );
+ idl = idl_allids( be );
+ goto done;
}
idl = keys2idl( be, type, indextype, ivals, err, &unindexed );
if ( unindexed ) {
@@ -322,6 +319,8 @@ ava_candidates(
LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
}
+done:
+ attr_done(&sattr);
return( idl );
}
@@ -520,28 +519,18 @@ range_candidates(
char *type,
struct berval *low_val,
struct berval *high_val,
- int *err
+ int *err,
+ const Slapi_Attr *sattr
)
{
IDList *idl;
struct berval *low = NULL, *high = NULL;
struct berval **lows = NULL, **highs = NULL;
- void *pi;
LDAPDebug(LDAP_DEBUG_TRACE, "=> range_candidates attr=%s\n", type, 0, 0);
- /*
- * get the keys corresponding to the assertion values
- */
-
- if ( slapi_attr_type2plugin( type, &pi ) != 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE, " slapi_filter_get_ava no plugin\n",
- 0, 0, 0 );
- return( NULL );
- }
-
if (low_val != NULL) {
- slapi_call_syntax_assertion2keys_ava(pi, low_val, &lows, LDAP_FILTER_EQUALITY);
+ slapi_attr_assertion2keys_ava(sattr, low_val, &lows, LDAP_FILTER_EQUALITY);
if (lows == NULL || *lows == NULL) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
@@ -551,7 +540,7 @@ range_candidates(
}
if (high_val != NULL) {
- slapi_call_syntax_assertion2keys_ava(pi, high_val, &highs, LDAP_FILTER_EQUALITY);
+ slapi_attr_assertion2keys_ava(sattr, high_val, &highs, LDAP_FILTER_EQUALITY);
if (highs == NULL || *highs == NULL) {
LDAPDebug( LDAP_DEBUG_TRACE,
"<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
@@ -698,7 +687,11 @@ list_candidates(
is_bounded_range = 0;
}
if (is_bounded_range) {
- idl = range_candidates(pb, be, tpairs[0], vpairs[0], vpairs[1], err);
+ Slapi_Attr sattr;
+
+ slapi_attr_init(&sattr, tpairs[0]);
+ idl = range_candidates(pb, be, tpairs[0], vpairs[0], vpairs[1], err, &sattr);
+ attr_done(&sattr);
LDAPDebug( LDAP_DEBUG_TRACE, "<= list_candidates %lu\n",
(u_long)IDL_NIDS(idl), 0, 0 );
goto out;
@@ -734,8 +727,12 @@ list_candidates(
}
else if (fpairs[1] == f)
{
+ Slapi_Attr sattr;
+
+ slapi_attr_init(&sattr, tpairs[0]);
tmp = range_candidates(pb, be, tpairs[0],
- vpairs[0], vpairs[1], err);
+ vpairs[0], vpairs[1], err, &sattr);
+ attr_done(&sattr);
if (tmp == NULL && ftype == LDAP_FILTER_AND)
{
LDAPDebug( LDAP_DEBUG_TRACE,
@@ -839,10 +836,10 @@ substring_candidates(
char *type, *initial, *final;
char **any;
IDList *idl;
- void *pi;
Slapi_Value **ivals;
int unindexed = 0;
unsigned int opnote = SLAPI_OP_NOTE_UNINDEXED;
+ Slapi_Attr sattr;
LDAPDebug( LDAP_DEBUG_TRACE, "=> sub_candidates\n", 0, 0, 0 );
@@ -856,12 +853,9 @@ substring_candidates(
* get the index keys corresponding to the substring
* assertion values
*/
- if ( slapi_attr_type2plugin( type, &pi ) != 0 ) {
- LDAPDebug( LDAP_DEBUG_TRACE, " sub_candidates no plugin\n",
- 0, 0, 0 );
- return( NULL );
- }
- slapi_call_syntax_assertion2keys_sub_sv( pi, initial, any, final, &ivals );
+ slapi_attr_init(&sattr, type);
+ slapi_attr_assertion2keys_sub_sv( &sattr, initial, any, final, &ivals );
+ attr_done(&sattr);
if ( ivals == NULL || *ivals == NULL ) {
slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
LDAPDebug( LDAP_DEBUG_TRACE,
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index d7afb471..f26e3d37 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -54,7 +54,7 @@ static const char *errmsg = "database index operation failed";
static int is_indexed (const char* indextype, int indexmask, char** index_rules);
static Slapi_Value **
valuearray_minus_valuearray(
- void *plugin,
+ const Slapi_Attr *sattr,
Slapi_Value **a,
Slapi_Value **b
);
@@ -1848,8 +1848,7 @@ index_addordel_values_ext_sv(
/* on delete, only remove the equality index if the
* BE_INDEX_EQUALITY flag is set.
*/
- slapi_call_syntax_values2keys_sv( ai->ai_plugin, vals, &ivals,
- LDAP_FILTER_EQUALITY );
+ slapi_attr_values2keys_sv( &ai->ai_sattr, vals, &ivals, LDAP_FILTER_EQUALITY );
err = addordel_values_sv( be, db, basetype, indextype_EQUALITY,
ivals != NULL ? ivals : vals, id, flags, txn, ai, idl_disposition, NULL );
@@ -1866,8 +1865,7 @@ index_addordel_values_ext_sv(
* approximate index entry
*/
if ( ai->ai_indexmask & INDEX_APPROX ) {
- slapi_call_syntax_values2keys_sv( ai->ai_plugin, vals, &ivals,
- LDAP_FILTER_APPROX );
+ slapi_attr_values2keys_sv( &ai->ai_sattr, vals, &ivals, LDAP_FILTER_APPROX );
if ( ivals != NULL ) {
err = addordel_values_sv( be, db, basetype,
@@ -1892,19 +1890,19 @@ index_addordel_values_ext_sv(
/* prepare pblock to pass ai_substr_lens */
pblock_init( &pipb );
slapi_pblock_set( &pipb, SLAPI_SYNTAX_SUBSTRLENS, ai->ai_substr_lens );
- slapi_call_syntax_values2keys_sv_pb( ai->ai_plugin, vals, &ivals,
+ slapi_attr_values2keys_sv_pb( &ai->ai_sattr, vals, &ivals,
LDAP_FILTER_SUBSTRINGS, &pipb );
origvals = ivals;
/* delete only: if the attribute has multiple values,
* figure out the substrings that should remain
- * by slapi_call_syntax_values2keys,
+ * by slapi_attr_values2keys,
* then get rid of them from the being deleted values
*/
if ( evals != NULL ) {
- slapi_call_syntax_values2keys_sv_pb( ai->ai_plugin, evals,
+ slapi_attr_values2keys_sv_pb( &ai->ai_sattr, evals,
&esubvals, LDAP_FILTER_SUBSTRINGS, &pipb );
- substresult = valuearray_minus_valuearray( ai->ai_plugin, ivals, esubvals );
+ substresult = valuearray_minus_valuearray( &ai->ai_sattr, ivals, esubvals );
ivals = substresult;
valuearray_free( &esubvals );
}
@@ -2070,7 +2068,7 @@ bvals_strcasecmp(const struct berval *a, const struct berval *b)
/* the returned array of Slapi_Value needs to be freed. */
static Slapi_Value **
valuearray_minus_valuearray(
- void *plugin,
+ const Slapi_Attr *sattr,
Slapi_Value **a,
Slapi_Value **b
)
@@ -2081,7 +2079,7 @@ valuearray_minus_valuearray(
value_compare_fn_type cmp_fn;
/* get berval comparison function */
- plugin_call_syntax_get_compare_fn(plugin, &cmp_fn);
+ attr_get_value_cmp_fn(sattr, &cmp_fn);
if (cmp_fn == NULL) {
cmp_fn = (value_compare_fn_type)bvals_strcasecmp;
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 1042cf7e..3866e121 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -61,6 +61,7 @@ attrinfo_delete(struct attrinfo **pp)
slapi_ch_free((void**)&((*pp)->ai_type));
slapi_ch_free((void**)(*pp)->ai_index_rules);
slapi_ch_free((void**)&((*pp)->ai_attrcrypt));
+ attr_done(&((*pp)->ai_sattr));
slapi_ch_free((void**)pp);
*pp= NULL;
}
@@ -194,11 +195,15 @@ attr_index_config(
}
for ( i = 0; attrs[i] != NULL; i++ ) {
int need_compare_fn = 0;
- char *attrsyntax_oid = NULL;
+ const char *attrsyntax_oid = NULL;
a = attrinfo_new();
+ slapi_attr_init(&a->ai_sattr, attrs[i]);
+ /* we can't just set a->ai_type to the type from a->ai_sattr
+ if the type has attroptions or subtypes, ai_sattr.a_type will
+ contain them - but for the purposes of indexing, we don't want
+ them */
a->ai_type = slapi_attr_basetype( attrs[i], NULL, 0 );
- slapi_attr_type2plugin( a->ai_type, &a->ai_plugin );
- attrsyntax_oid = slapi_ch_strdup(plugin_syntax2oid(a->ai_plugin));
+ attrsyntax_oid = attr_get_syntax_oid(&a->ai_sattr);
if ( argc == 1 ) {
a->ai_indexmask = (INDEX_PRESENCE | INDEX_EQUALITY |
INDEX_APPROX | INDEX_SUB);
@@ -301,7 +306,6 @@ attr_index_config(
}
}
- slapi_ch_free_string(&attrsyntax_oid);
/* initialize the IDL code's private data */
return_value = idl_init_private(be, a);
if (0 != return_value) {
@@ -322,11 +326,11 @@ attr_index_config(
}
if (need_compare_fn) {
- int rc = plugin_call_syntax_get_compare_fn( a->ai_plugin, &a->ai_key_cmp_fn );
+ int rc = attr_get_value_cmp_fn( &a->ai_sattr, &a->ai_key_cmp_fn );
if (rc != LDAP_SUCCESS) {
LDAPDebug(LDAP_DEBUG_ANY,
- "The attribute [%s] does not have a valid ORDERING matching rule\n",
- a->ai_type, 0, 0);
+ "The attribute [%s] does not have a valid ORDERING matching rule - error %d:s\n",
+ a->ai_type, rc, ldap_err2string(rc));
a->ai_key_cmp_fn = NULL;
}
}
@@ -358,6 +362,7 @@ attr_create_empty(backend *be,char *type,struct attrinfo **ai)
{
ldbm_instance *inst = (ldbm_instance *) be->be_instance_info;
struct attrinfo *a = attrinfo_new();
+ slapi_attr_init(&a->ai_sattr, type);
a->ai_type = slapi_ch_strdup(type);
if ( avl_insert( &inst->inst_attrs, a, ainfo_cmp, ainfo_dup ) != 0 ) {
/* duplicate - existing version updated */
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index 70a2b1fe..ce79c6fe 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -1408,7 +1408,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
&psrdn, NULL, 0,
run_from_cmdline, NULL);
if (rc) {
- LDAPDebugArg(LDAP_DEBUG_ANY,
+ LDAPDebug1Arg(LDAP_DEBUG_ANY,
"ldbm2ldif: Failed to get dn of ID "
"%d\n", pid);
slapi_ch_free_string(&rdn);
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index a64919c8..f12d41d5 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -418,12 +418,13 @@ int ldbm_back_rmdb( Slapi_PBlock *pb );
*/
struct sort_spec_thing
{
- char *type;
+ char *type; /* attribute type */
char *matchrule; /* Matching rule string */
int order; /* 0 == ascending, 1 == decending */
struct sort_spec_thing *next; /* Link to the next one */
Slapi_PBlock *mr_pb; /* For matchrule indexing */
value_compare_fn_type compare_fn; /* For non-matchrule indexing */
+ Slapi_Attr sattr;
};
typedef struct sort_spec_thing sort_spec_thing;
typedef struct sort_spec_thing sort_spec;
diff --git a/ldap/servers/slapd/back-ldbm/sort.c b/ldap/servers/slapd/back-ldbm/sort.c
index b7114f50..10d44170 100644
--- a/ldap/servers/slapd/back-ldbm/sort.c
+++ b/ldap/servers/slapd/back-ldbm/sort.c
@@ -71,6 +71,7 @@ static void sort_spec_thing_free(sort_spec_thing *s)
destroy_matchrule_indexer(s->mr_pb);
slapi_pblock_destroy (s->mr_pb);
}
+ attr_done(&s->sattr);
slapi_ch_free( (void**)&s);
}
@@ -100,6 +101,7 @@ static sort_spec_thing * sort_spec_thing_new(char *type, char* matchrule, int re
s->type = type;
s->matchrule = matchrule;
s->order = reverse;
+ slapi_attr_init(&s->sattr, type);
return s;
}
@@ -188,12 +190,8 @@ int sort_candidates(backend *be,int lookthrough_limit,time_t time_up, Slapi_PBlo
/* Iterate over the sort types */
for (this_s = s; this_s; this_s=this_s->next) {
if (NULL == this_s->matchrule) {
- void *pi;
int return_value = 0;
- return_value = slapi_attr_type2plugin( this_s->type, &pi );
- if (0 == return_value) {
- return_value = plugin_call_syntax_get_compare_fn( pi, &(this_s->compare_fn) );
- }
+ return_value = attr_get_value_cmp_fn( &this_s->sattr, &(this_s->compare_fn) );
if (return_value != 0 ) {
LDAPDebug( LDAP_DEBUG_TRACE, "Attempting to sort a non-ordered attribute (%s)\n",this_s->type, 0, 0 );
/* DBDB we should set the error type here */
diff --git a/ldap/servers/slapd/back-ldbm/vlv.c b/ldap/servers/slapd/back-ldbm/vlv.c
index db809c45..2402017d 100644
--- a/ldap/servers/slapd/back-ldbm/vlv.c
+++ b/ldap/servers/slapd/back-ldbm/vlv.c
@@ -564,9 +564,9 @@ vlv_create_key(struct vlvIndex* p, struct backentry* e)
int totalattrs;
if (p->vlv_sortkey[sortattr]->sk_matchruleoid==NULL)
{
- /* No matching rule. Syntax Plugin mangles value. */
+ /* No matching rule. mangle values according to matching rule or syntax */
Slapi_Value **va= valueset_get_valuearray(&attr->a_present_values);
- slapi_call_syntax_values2keys_sv( p->vlv_syntax_plugin[sortattr], va, &cvalue, LDAP_FILTER_EQUALITY );
+ slapi_attr_values2keys_sv( attr, va, &cvalue, LDAP_FILTER_EQUALITY );
valuearray_get_bervalarray(cvalue,&value);
/* XXXSD need to free some more stuff */
@@ -933,7 +933,10 @@ vlv_build_candidate_list_byvalue( struct vlvIndex* p, DBC *dbc, PRUint32 length,
invalue[1]= NULL;
if (p->vlv_sortkey[0]->sk_matchruleoid==NULL)
{
- slapi_call_syntax_values2keys(p->vlv_syntax_plugin[0],invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
+ Slapi_Attr sattr;
+ slapi_attr_init(&sattr, p->vlv_sortkey[0]->sk_attrtype);
+ slapi_attr_values2keys(&sattr,invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
+ attr_done(&sattr);
}
else
{
@@ -1484,14 +1487,19 @@ vlv_trim_candidates_byvalue(backend *be, const IDList *candidates, const sort_sp
*/
if (sort_control->matchrule==NULL)
{
- void *pi= NULL;
- if(slapi_attr_type2plugin(sort_control->type, &pi)==0)
+ attr_get_value_cmp_fn(&sort_control->sattr, &compare_fn);
+ if (compare_fn == NULL) {
+ LDAPDebug1Arg(LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: "
+ "attempt to compare an unordered attribute [%s]\n",
+ sort_control->type);
+ compare_fn = slapi_berval_cmp;
+ }
+
{
struct berval *invalue[2];
invalue[0]= (struct berval *)&vlv_request_control->value; /* jcm: cast away const */
invalue[1]= NULL;
- slapi_call_syntax_values2keys(pi,invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
- plugin_call_syntax_get_compare_fn( pi, &compare_fn );
+ slapi_attr_values2keys(&sort_control->sattr,invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
if (compare_fn == NULL) {
LDAPDebug(LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: "
"attempt to compare an unordered attribute",
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.c b/ldap/servers/slapd/back-ldbm/vlv_srch.c
index d9a14a42..da59ba3d 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.c
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c
@@ -534,7 +534,6 @@ vlvIndex_new()
p->vlv_sortkey= NULL;
p->vlv_filename= NULL;
p->vlv_mrpb= NULL;
- p->vlv_syntax_plugin= NULL;
p->vlv_indexlength_lock= PR_NewLock();
p->vlv_indexlength_cached= 0;
p->vlv_indexlength= 0;
@@ -572,7 +571,6 @@ vlvIndex_delete(struct vlvIndex** ppvs)
slapi_ch_free((void**)&((*ppvs)->vlv_name));
slapi_ch_free((void**)&((*ppvs)->vlv_filename));
slapi_ch_free((void**)&((*ppvs)->vlv_mrpb));
- slapi_ch_free((void**)&((*ppvs)->vlv_syntax_plugin));
PR_DestroyLock((*ppvs)->vlv_indexlength_lock);
slapi_ch_free((void**)ppvs);
*ppvs= NULL;
@@ -611,10 +609,8 @@ vlvIndex_init(struct vlvIndex* p, backend *be, struct vlvSearch* pSearch, const
int n;
for(n=0;p->vlv_sortkey[n]!=NULL;n++);
p->vlv_mrpb= (Slapi_PBlock**)slapi_ch_calloc(n+1,sizeof(Slapi_PBlock*));
- p->vlv_syntax_plugin= (void **)(Slapi_PBlock**)slapi_ch_calloc(n+1,sizeof(Slapi_PBlock*));
for(n=0;p->vlv_sortkey[n]!=NULL;n++)
{
- slapi_attr_type2plugin( p->vlv_sortkey[n]->sk_attrtype, &p->vlv_syntax_plugin[n] );
if(p->vlv_sortkey[n]->sk_matchruleoid!=NULL)
{
create_matchrule_indexer(&p->vlv_mrpb[n],p->vlv_sortkey[n]->sk_matchruleoid,p->vlv_sortkey[n]->sk_attrtype);
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.h b/ldap/servers/slapd/back-ldbm/vlv_srch.h
index e32cf88b..331dbf7d 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.h
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.h
@@ -106,9 +106,6 @@ struct vlvIndex
/* Attribute Structure maps filename onto index */
struct attrinfo *vlv_attrinfo;
- /* Syntax Plugin. One for each LDAPsortkey */
- void **vlv_syntax_plugin;
-
/* Matching Rule PBlock. One for each LDAPsortkey */
Slapi_PBlock **vlv_mrpb;