From bd243c07a38bb5ee97d1704d23e48d988ce3914a Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 24 May 2000 20:21:46 +0000 Subject: [PATCH] Add hooks for syntax normalizer (used by value_match) and prettier (to be used by update operations). --- servers/slapd/slap.h | 2 ++ servers/slapd/value.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 73f33a9f47..d3a73807d4 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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 */ diff --git a/servers/slapd/value.c b/servers/slapd/value.c index 753c724005..21ec4e067e 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -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; } -- 2.39.5