Add a value_validate() function to be used by prior to value_normalize

calls as needed (compare/filters).
This commit is contained in:
Kurt Zeilenga 2002-03-01 17:36:22 +00:00
parent c476878fde
commit c0fdb1aaca
2 changed files with 36 additions and 0 deletions

View File

@ -942,6 +942,10 @@ LDAP_SLAPD_F (void) slap_init_user LDAP_P(( char *username, char *groupname ));
/*
* value.c
*/
LDAP_SLAPD_F (int) value_validate LDAP_P((
MatchingRule *mr,
struct berval *in,
const char ** text ));
LDAP_SLAPD_F (int) value_normalize LDAP_P((
AttributeDescription *ad,
unsigned usage,

View File

@ -53,6 +53,38 @@ value_add(
return LDAP_SUCCESS;
}
int
value_validate(
MatchingRule *mr,
struct berval *in,
const char **text )
{
int rc;
if( mr == NULL ) {
*text = "inappropriate matching request";
return LDAP_INAPPROPRIATE_MATCHING;
}
if( mr->smr_syntax == NULL ) {
*text = "no assertion syntax";
return LDAP_INVALID_SYNTAX;
}
if( ! mr->smr_syntax->ssyn_validate ) {
*text = "no syntax validator";
return LDAP_INVALID_SYNTAX;
}
rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in );
if( rc != LDAP_SUCCESS ) {
*text = "value is invalid";
return LDAP_INVALID_SYNTAX;
}
return LDAP_SUCCESS;
}
int
value_normalize(