Fix previous commit

This commit is contained in:
Howard Chu 2002-01-26 06:52:11 +00:00
parent 7f54a89f32
commit b907603b2d

View File

@ -569,14 +569,13 @@ dnParent(
struct berval *dn, struct berval *dn,
struct berval *pdn ) struct berval *pdn )
{ {
const char *p; char *p;
p = strchr( dn->bv_val, ',' ); p = strchr( dn->bv_val, ',' );
/* one-level dn */ /* one-level dn */
if ( p == NULL ) { if ( p == NULL ) {
pdn->bv_val = ""; *pdn = slap_empty_bv;
pdn->bv_len = 0;
return LDAP_SUCCESS; return LDAP_SUCCESS;
} }
@ -645,8 +644,7 @@ dn_parent(
Backend *be, Backend *be,
const char *dn ) const char *dn )
{ {
const char *pdn; struct berval bv, pdn;
struct berval bv;
if ( dn == NULL ) { if ( dn == NULL ) {
return NULL; return NULL;
@ -660,17 +658,17 @@ dn_parent(
return NULL; return NULL;
} }
bv.bv_val = dn; bv.bv_val = (char *)dn;
bv.bv_len = strlen(bv.bv_val); bv.bv_len = strlen(bv.bv_val);
if ( be != NULL && be_issuffix( be, &bv ) ) { if ( be != NULL && be_issuffix( be, &bv ) ) {
return NULL; return NULL;
} }
if ( dnParent( dn, &pdn ) != LDAP_SUCCESS ) { if ( dnParent( &bv, &pdn ) != LDAP_SUCCESS ) {
return NULL; return NULL;
} }
return ( char * )pdn; return pdn.bv_val;
} }
#endif /* SLAP_DN_MIGRATION */ #endif /* SLAP_DN_MIGRATION */