From 49a4ae59ba01d63a7bcc2308097f41c223ae7681 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 25 Apr 2003 01:01:53 +0000 Subject: [PATCH] Need to pretty assertion values --- servers/slapd/value.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/servers/slapd/value.c b/servers/slapd/value.c index bd9cf9c7ec..c05c1a0975 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -133,6 +133,8 @@ int asserted_value_validate_normalize( void *ctx ) { int rc; + struct berval pval; + pval.bv_val = NULL; /* we expect the value to be in the assertion syntax */ assert( !SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX(usage) ); @@ -147,7 +149,13 @@ int asserted_value_validate_normalize( return LDAP_INAPPROPRIATE_MATCHING; } - rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in ); + if( mr->smr_syntax->ssyn_pretty ) { + rc = (mr->smr_syntax->ssyn_pretty)( mr->smr_syntax, in, &pval, ctx ); + in = &pval; + + } else { + rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in ); + } if( rc != LDAP_SUCCESS ) { *text = "value does not conform to assertion syntax"; @@ -159,11 +167,16 @@ int asserted_value_validate_normalize( ad ? ad->ad_type->sat_syntax : NULL, mr, in, out, ctx ); + if( pval.bv_val ) ber_memfree_x( pval.bv_val, ctx ); + if( rc != LDAP_SUCCESS ) { *text = "unable to normalize value for matching"; return LDAP_INVALID_SYNTAX; } + } else if ( pval.bv_val != NULL ) { + *out = pval; + } else { ber_dupbv_x( out, in, ctx ); }