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 */ /* create exactly the required entry */
if ( dnExtractRdn( ndn->bv_val, &rdn ) != LDAP_SUCCESS ) { if ( dnExtractRdn( ndn, &rdn ) != LDAP_SUCCESS ) {
return( -1 ); return( -1 );
} }

View File

@ -605,7 +605,7 @@ dn_parent(
int int
dnExtractRdn( dnExtractRdn(
const char *dn, struct berval *dn,
struct berval **rdn ) struct berval **rdn )
{ {
LDAPRDN *tmpRDN; LDAPRDN *tmpRDN;
@ -616,7 +616,11 @@ dnExtractRdn(
assert( dn ); assert( dn );
assert( rdn ); 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 ) { if ( rc != LDAP_SUCCESS ) {
return rc; return rc;
} }
@ -644,6 +648,7 @@ dn_rdnlen(
Backend *be, Backend *be,
const char *dn_in ) const char *dn_in )
{ {
struct berval bv;
struct berval *rdn = NULL; struct berval *rdn = NULL;
int retval = 0; int retval = 0;
@ -665,7 +670,10 @@ dn_rdnlen(
return 0; 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 ); ber_bvfree( rdn );
return 0; return 0;
} }
@ -683,6 +691,7 @@ char * dn_rdn(
Backend *be, Backend *be,
const char *dn_in ) const char *dn_in )
{ {
struct berval bv;
struct berval *rdn = NULL; struct berval *rdn = NULL;
char *retval; char *retval;
@ -704,7 +713,10 @@ char * dn_rdn(
return NULL; 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 ); ber_bvfree( rdn );
return NULL; return NULL;
} }

View File

@ -374,7 +374,7 @@ LDAP_SLAPD_F (int) dnIsSuffix LDAP_P((
const struct berval *dn, const struct berval *suffix )); const struct berval *dn, const struct berval *suffix ));
LDAP_SLAPD_F (int) dnExtractRdn LDAP_P(( 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 )); LDAP_SLAPD_F (int) rdnValidate LDAP_P(( struct berval * rdn ));