mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-30 03:29:35 -05:00
Check for NULs in DNs.
This commit is contained in:
parent
6913aadcdf
commit
ee6d1a4d40
2 changed files with 21 additions and 8 deletions
|
|
@ -648,8 +648,11 @@ ldap_bv2dn( struct berval *bv, LDAPDN **dn, unsigned flags )
|
|||
return LDAP_PARAM_ERROR;
|
||||
}
|
||||
|
||||
if ( str[ 0 ] == '\0' ) {
|
||||
if ( bv->bv_len == 0 ) {
|
||||
return LDAP_SUCCESS;
|
||||
|
||||
} else if ( str[ 0 ] == '\0' ) {
|
||||
return LDAP_DECODING_ERROR;
|
||||
}
|
||||
|
||||
p = str;
|
||||
|
|
@ -873,8 +876,11 @@ ldap_bv2rdn( struct berval *bv, LDAPRDN **rdn,
|
|||
return LDAP_PARAM_ERROR;
|
||||
}
|
||||
|
||||
if ( str[ 0 ] == '\0' ) {
|
||||
if ( bv->bv_len == 0 ) {
|
||||
return LDAP_SUCCESS;
|
||||
|
||||
} else if ( str[ 0 ] == '\0' ) {
|
||||
return LDAP_DECODING_ERROR;
|
||||
}
|
||||
|
||||
p = str;
|
||||
|
|
|
|||
|
|
@ -117,20 +117,21 @@ dnValidate(
|
|||
}
|
||||
|
||||
rc = ldap_bv2dn( in, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
assert( strlen( in->bv_val ) == in->bv_len );
|
||||
|
||||
/*
|
||||
* Schema-aware validate
|
||||
*/
|
||||
rc = LDAPDN_validate( dn );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
rc = LDAPDN_validate( dn );
|
||||
ldap_dnfree( dn );
|
||||
}
|
||||
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return( LDAP_INVALID_SYNTAX );
|
||||
}
|
||||
|
||||
return( LDAP_SUCCESS );
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -354,6 +355,8 @@ dnNormalize2(
|
|||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
assert( strlen( val->bv_val ) == val->bv_len );
|
||||
|
||||
/*
|
||||
* Schema-aware rewrite
|
||||
*/
|
||||
|
|
@ -425,6 +428,8 @@ dnPretty2(
|
|||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
assert( strlen( val->bv_val ) == val->bv_len );
|
||||
|
||||
/*
|
||||
* Schema-aware rewrite
|
||||
*/
|
||||
|
|
@ -485,6 +490,8 @@ dnPrettyNormal(
|
|||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
assert( strlen( val->bv_val ) == val->bv_len );
|
||||
|
||||
/*
|
||||
* Schema-aware rewrite
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue