dnExtractRDN should take a struct berval DN.

This commit is contained in:
Kurt Zeilenga 2001-12-27 17:17:01 +00:00
parent 0bff9e6eb7
commit cefce9c965
3 changed files with 18 additions and 6 deletions

View File

@ -405,7 +405,7 @@ monitor_subsys_conn_create(
/* create exactly the required entry */
if ( dnExtractRdn( ndn->bv_val, &rdn ) != LDAP_SUCCESS ) {
if ( dnExtractRdn( ndn, &rdn ) != LDAP_SUCCESS ) {
return( -1 );
}

View File

@ -605,7 +605,7 @@ dn_parent(
int
dnExtractRdn(
const char *dn,
struct berval *dn,
struct berval **rdn )
{
LDAPRDN *tmpRDN;
@ -616,7 +616,11 @@ dnExtractRdn(
assert( dn );
assert( rdn );
rc = ldap_str2rdn( dn, &tmpRDN, &p, LDAP_DN_FORMAT_LDAP );
if( dn->bv_len == 0 ) {
return LDAP_OTHER;
}
rc = ldap_str2rdn( dn->bv_val, &tmpRDN, &p, LDAP_DN_FORMAT_LDAP );
if ( rc != LDAP_SUCCESS ) {
return rc;
}
@ -644,6 +648,7 @@ dn_rdnlen(
Backend *be,
const char *dn_in )
{
struct berval bv;
struct berval *rdn = NULL;
int retval = 0;
@ -665,7 +670,10 @@ dn_rdnlen(
return 0;
}
if ( dnExtractRdn( dn_in, &rdn ) != LDAP_SUCCESS ) {
bv.bv_val = (char *) dn_in;
bv.bv_len = strlen( bv.bv_val );
if ( dnExtractRdn( &bv, &rdn ) != LDAP_SUCCESS ) {
ber_bvfree( rdn );
return 0;
}
@ -683,6 +691,7 @@ char * dn_rdn(
Backend *be,
const char *dn_in )
{
struct berval bv;
struct berval *rdn = NULL;
char *retval;
@ -704,7 +713,10 @@ char * dn_rdn(
return NULL;
}
if ( dnExtractRdn( dn_in, &rdn ) != LDAP_SUCCESS ) {
bv.bv_val = (char *) dn_in;
bv.bv_len = strlen( bv.bv_val );
if ( dnExtractRdn( &bv, &rdn ) != LDAP_SUCCESS ) {
ber_bvfree( rdn );
return NULL;
}

View File

@ -374,7 +374,7 @@ LDAP_SLAPD_F (int) dnIsSuffix LDAP_P((
const struct berval *dn, const struct berval *suffix ));
LDAP_SLAPD_F (int) dnExtractRdn LDAP_P((
const char *dn, struct berval **rdn ));
struct berval *dn, struct berval **rdn ));
LDAP_SLAPD_F (int) rdnValidate LDAP_P(( struct berval * rdn ));