mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Need to pretty assertion values
This commit is contained in:
parent
af5f617d2a
commit
49a4ae59ba
@ -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 );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user