From: Hallvard Furuseth Date: Fri, 3 Jan 2003 17:06:01 +0000 (+0000) Subject: Fix octetStringOrderingMatch(). It thought "b"<"aa", becuase "b" is shorter. X-Git-Tag: NO_SLAP_OP_BLOCKS~619 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=aeaaa8c6ca5a2670f83533a82c42baf1b1b1787a;p=openldap Fix octetStringOrderingMatch(). It thought "b"<"aa", becuase "b" is shorter. --- diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index ab56f523fd..532e33b8c4 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -59,7 +59,6 @@ #define caseIgnoreOrderingMatch caseIgnoreMatch #define caseExactOrderingMatch caseExactMatch #define integerOrderingMatch integerMatch -#define octetStringOrderingMatch octetStringMatch /* unimplemented matching routines */ #define caseIgnoreListMatch NULL @@ -138,6 +137,26 @@ octetStringMatch( return LDAP_SUCCESS; } +static int +octetStringOrderingMatch( + int *matchp, + slap_mask_t flags, + Syntax *syntax, + MatchingRule *mr, + struct berval *value, + void *assertedValue ) +{ + ber_len_t v_len = value->bv_len; + ber_len_t av_len = ((struct berval *) assertedValue)->bv_len; + int match = memcmp( value->bv_val, + ((struct berval *) assertedValue)->bv_val, + (v_len < av_len ? v_len : av_len) ); + if( match == 0 ) + match = v_len - av_len; + *matchp = match; + return LDAP_SUCCESS; +} + /* Index generation function */ int octetStringIndexer( slap_mask_t use,