Need to pretty assertion values

This commit is contained in:
Kurt Zeilenga 2003-04-25 01:01:53 +00:00
parent af5f617d2a
commit 49a4ae59ba

View File

@ -133,6 +133,8 @@ int asserted_value_validate_normalize(
void *ctx ) void *ctx )
{ {
int rc; int rc;
struct berval pval;
pval.bv_val = NULL;
/* we expect the value to be in the assertion syntax */ /* we expect the value to be in the assertion syntax */
assert( !SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX(usage) ); assert( !SLAP_MR_IS_VALUE_OF_ATTRIBUTE_SYNTAX(usage) );
@ -147,7 +149,13 @@ int asserted_value_validate_normalize(
return LDAP_INAPPROPRIATE_MATCHING; return LDAP_INAPPROPRIATE_MATCHING;
} }
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 ); rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in );
}
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
*text = "value does not conform to assertion syntax"; *text = "value does not conform to assertion syntax";
@ -159,11 +167,16 @@ int asserted_value_validate_normalize(
ad ? ad->ad_type->sat_syntax : NULL, ad ? ad->ad_type->sat_syntax : NULL,
mr, in, out, ctx ); mr, in, out, ctx );
if( pval.bv_val ) ber_memfree_x( pval.bv_val, ctx );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
*text = "unable to normalize value for matching"; *text = "unable to normalize value for matching";
return LDAP_INVALID_SYNTAX; return LDAP_INVALID_SYNTAX;
} }
} else if ( pval.bv_val != NULL ) {
*out = pval;
} else { } else {
ber_dupbv_x( out, in, ctx ); ber_dupbv_x( out, in, ctx );
} }