mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Add a value_validate() function to be used by prior to value_normalize
calls as needed (compare/filters).
This commit is contained in:
parent
c476878fde
commit
c0fdb1aaca
@ -942,6 +942,10 @@ LDAP_SLAPD_F (void) slap_init_user LDAP_P(( char *username, char *groupname ));
|
|||||||
/*
|
/*
|
||||||
* value.c
|
* 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((
|
LDAP_SLAPD_F (int) value_normalize LDAP_P((
|
||||||
AttributeDescription *ad,
|
AttributeDescription *ad,
|
||||||
unsigned usage,
|
unsigned usage,
|
||||||
|
@ -53,6 +53,38 @@ value_add(
|
|||||||
return LDAP_SUCCESS;
|
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
|
int
|
||||||
value_normalize(
|
value_normalize(
|
||||||
|
Loading…
Reference in New Issue
Block a user