]> git.sur5r.net Git - openldap/commitdiff
Add hooks for syntax normalizer (used by value_match)
authorKurt Zeilenga <kurt@openldap.org>
Wed, 24 May 2000 20:21:46 +0000 (20:21 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 24 May 2000 20:21:46 +0000 (20:21 +0000)
and prettier (to be used by update operations).

servers/slapd/slap.h
servers/slapd/value.c

index 73f33a9f4792a1397cf26251590a4108aba10bae..d3a73807d4d5d3c9a1dd61dbefc5192b06997e96 100644 (file)
@@ -161,6 +161,8 @@ typedef struct slap_syntax {
 #define SLAP_SYNTAX_BER                0x4U /* stored using BER encoding (binary,certificate) */
 
        slap_syntax_validate_func       *ssyn_validate;
+       slap_syntax_transform_func      *ssyn_normalize;
+       slap_syntax_transform_func      *ssyn_pretty;
 
 #ifdef SLAPD_BINARY_CONVERSION
        /* convert to and from binary */
index 753c7240051d37092c4998876421998cfffdead4..21ec4e067e39df46b91ddbb7fd13ac49ec8e1029 100644 (file)
@@ -186,6 +186,16 @@ value_match(
 {
        int rc;
        int usage = 0;
+       struct berval *nv1 = NULL;
+
+       if( ad->ad_type->sat_syntax->ssyn_normalize ) {
+               rc = ad->ad_type->sat_syntax->ssyn_normalize(
+                       ad->ad_type->sat_syntax, v1, &nv1 );
+
+               if( rc != LDAP_SUCCESS ) {
+                       return LDAP_INAPPROPRIATE_MATCHING;
+               }
+       }
 
        if( !mr->smr_match ) {
                return LDAP_INAPPROPRIATE_MATCHING;
@@ -193,8 +203,11 @@ value_match(
 
        rc = (mr->smr_match)( match, usage,
                ad->ad_type->sat_syntax,
-               mr, v1, v2 );
+               mr,
+               nv1 != NULL ? nv1 : v1,
+               v2 );
        
+       ber_bvfree( nv1 );
        return rc;
 }