summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ldap/servers/plugins/syntaxes/bin.c52
-rw-r--r--ldap/servers/plugins/syntaxes/numericstring.c2
-rw-r--r--ldap/servers/slapd/match.c2
-rw-r--r--ldap/servers/slapd/plugin_mr.c11
4 files changed, 47 insertions, 20 deletions
diff --git a/ldap/servers/plugins/syntaxes/bin.c b/ldap/servers/plugins/syntaxes/bin.c
index b1b46593..3d2d88ac 100644
--- a/ldap/servers/plugins/syntaxes/bin.c
+++ b/ldap/servers/plugins/syntaxes/bin.c
@@ -249,26 +249,44 @@ static int
bin_filter_ava( Slapi_PBlock *pb, struct berval *bvfilter,
Slapi_Value **bvals, int ftype, Slapi_Value **retVal )
{
- int i;
+ int i;
- for ( i = 0; bvals[i] != NULL; i++ ) {
+ for ( i = 0; bvals[i] != NULL; i++ ) {
const struct berval *bv = slapi_value_get_berval(bvals[i]);
-
- if ( ( bv->bv_len == bvfilter->bv_len ) &&
- ( 0 == memcmp( bv->bv_val, bvfilter->bv_val, bvfilter->bv_len ) ) )
- {
- if(retVal!=NULL)
- {
- *retVal= bvals[i];
- }
- return( 0 );
+ int rc = slapi_berval_cmp(bv, bvfilter);
+
+ switch ( ftype ) {
+ case LDAP_FILTER_GE:
+ if ( rc >= 0 ) {
+ if(retVal) {
+ *retVal = bvals[i];
+ }
+ return( 0 );
+ }
+ break;
+ case LDAP_FILTER_LE:
+ if ( rc <= 0 ) {
+ if(retVal) {
+ *retVal = bvals[i];
+ }
+ return( 0 );
+ }
+ break;
+ case LDAP_FILTER_EQUALITY:
+ if ( rc == 0 ) {
+ if(retVal) {
+ *retVal = bvals[i];
+ }
+ return( 0 );
+ }
+ break;
}
- }
- if(retVal!=NULL)
- {
- *retVal= NULL;
- }
- return( -1 );
+ }
+ if(retVal!=NULL)
+ {
+ *retVal= NULL;
+ }
+ return( -1 );
}
static int
diff --git a/ldap/servers/plugins/syntaxes/numericstring.c b/ldap/servers/plugins/syntaxes/numericstring.c
index d1bf475d..0cb4876d 100644
--- a/ldap/servers/plugins/syntaxes/numericstring.c
+++ b/ldap/servers/plugins/syntaxes/numericstring.c
@@ -148,7 +148,7 @@ numstr_init( Slapi_PBlock *pb )
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
(void *) names );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
- (void *) INTEGER_SYNTAX_OID );
+ (void *) NUMERICSTRING_SYNTAX_OID );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
(void *) numstr_compare );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
diff --git a/ldap/servers/slapd/match.c b/ldap/servers/slapd/match.c
index 241b182c..91fa0a8f 100644
--- a/ldap/servers/slapd/match.c
+++ b/ldap/servers/slapd/match.c
@@ -322,7 +322,7 @@ int slapi_matchingrule_is_compat(const char *mr_oid_or_name, const char *syntax_
return 1;
}
for (mr_syntax = mrl->mr_entry->mr_compat_syntax;
- mr_syntax;
+ mr_syntax && *mr_syntax;
mr_syntax++) {
if (!strcmp(*mr_syntax, syntax_oid)) {
return 1;
diff --git a/ldap/servers/slapd/plugin_mr.c b/ldap/servers/slapd/plugin_mr.c
index 194f8aef..7590f268 100644
--- a/ldap/servers/slapd/plugin_mr.c
+++ b/ldap/servers/slapd/plugin_mr.c
@@ -170,7 +170,7 @@ plugin_mr_bind (char* oid, struct slapdplugin* plugin)
PR_Lock (global_mr_oids_lock);
i->oi_next = global_mr_oids;
global_mr_oids = i;
- PR_Unlock (global_mr_oids_lock);
+ PR_Unlock (global_mr_oids_lock);
LDAPDebug (LDAP_DEBUG_FILTER, "<= plugin_mr_bind\n", 0, 0, 0);
}
@@ -449,6 +449,15 @@ default_mr_filter_create(Slapi_PBlock *pb)
LDAPDebug2Args(LDAP_DEBUG_FILTER, "=> default_mr_filter_create(oid %s; type %s)\n",
mrOID, mrTYPE);
+ /* check to make sure this create function is supposed to be used with the
+ given oid */
+ if (!charray_inlist(pi->plg_mr_names, mrOID)) {
+ LDAPDebug2Args(LDAP_DEBUG_FILTER,
+ "=> default_mr_filter_create: cannot use matching rule %s with plugin %s\n",
+ mrOID, pi->plg_name);
+ goto done;
+ }
+
ftype = plugin_mr_get_type(pi);
/* map the ftype to the op type */
if (ftype == LDAP_FILTER_GE) {