mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-01 20:49:35 -05:00
prepare for ldap_bv2dn()
This commit is contained in:
parent
ab099caed5
commit
959edd88c0
3 changed files with 27 additions and 14 deletions
|
|
@ -1203,6 +1203,12 @@ ldap_rdnfree LDAP_P(( LDAPRDN *rdn ));
|
|||
LDAP_F( void )
|
||||
ldap_dnfree LDAP_P(( LDAPDN *dn ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_bv2dn LDAP_P((
|
||||
struct berval *bv,
|
||||
LDAPDN **dn,
|
||||
unsigned flags ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_str2dn LDAP_P((
|
||||
LDAP_CONST char *str,
|
||||
|
|
|
|||
|
|
@ -598,6 +598,23 @@ ldap_dnfree( LDAPDN *dn )
|
|||
#define TMP_AVA_SLOTS 8
|
||||
#define TMP_RDN_SLOTS 32
|
||||
|
||||
int
|
||||
ldap_bv2dn( struct berval *bv, LDAPDN **dn, unsigned flags )
|
||||
{
|
||||
assert( bv );
|
||||
assert( dn );
|
||||
|
||||
/*
|
||||
* FIXME: ldap_bv2dn() and ldap_str2dn() will be swapped,
|
||||
* i.e. ldap_str2dn() will become a wrapper for ldap_bv2dn()
|
||||
*/
|
||||
if ( bv->bv_len != strlen( bv->bv_val ) ) {
|
||||
return LDAP_INVALID_DN_SYNTAX;
|
||||
}
|
||||
|
||||
return ldap_str2dn( bv->bv_val, dn, flags );
|
||||
}
|
||||
|
||||
int
|
||||
ldap_str2dn( LDAP_CONST char *str, LDAPDN **dn, unsigned flags )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -116,12 +116,7 @@ dnValidate(
|
|||
return( LDAP_SUCCESS );
|
||||
}
|
||||
|
||||
/* FIXME: str2dn should take a bv and handle this */
|
||||
if( strlen( in->bv_val ) != in->bv_len ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
rc = ldap_str2dn( in->bv_val, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
rc = ldap_bv2dn( in, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
|
||||
/*
|
||||
* Schema-aware validate
|
||||
|
|
@ -354,7 +349,7 @@ dnNormalize2(
|
|||
/*
|
||||
* Go to structural representation
|
||||
*/
|
||||
rc = ldap_str2dn( val->bv_val, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
rc = ldap_bv2dn( val, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
|
@ -424,13 +419,8 @@ dnPretty2(
|
|||
LDAPDN *dn = NULL;
|
||||
int rc;
|
||||
|
||||
/* FIXME: str2dn should take a bv and handle this */
|
||||
if( strlen( val->bv_val ) != val->bv_len ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
||||
/* FIXME: should be liberal in what we accept */
|
||||
rc = ldap_str2dn( val->bv_val, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
rc = ldap_bv2dn( val, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
|
@ -495,7 +485,7 @@ dnPrettyNormal(
|
|||
}
|
||||
|
||||
/* FIXME: should be liberal in what we accept */
|
||||
rc = ldap_str2dn( val->bv_val, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
rc = ldap_bv2dn( val, &dn, LDAP_DN_FORMAT_LDAP );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue