]> git.sur5r.net Git - openldap/commitdiff
Fix octetStringOrderingMatch(). It thought "b"<"aa", becuase "b" is shorter.
authorHallvard Furuseth <hallvard@openldap.org>
Fri, 3 Jan 2003 17:06:01 +0000 (17:06 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Fri, 3 Jan 2003 17:06:01 +0000 (17:06 +0000)
servers/slapd/schema_init.c

index ab56f523fdcacb0dd9ff1003262ba419b0c670ba..532e33b8c4c82ae16027260dc17d310790324145 100644 (file)
@@ -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,