From b907603b2d0b865124e8f8df2db102d85ba8c986 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 26 Jan 2002 06:52:11 +0000 Subject: [PATCH] Fix previous commit --- servers/slapd/dn.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 5068a04615..7d836a630e 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -569,14 +569,13 @@ dnParent( struct berval *dn, struct berval *pdn ) { - const char *p; + char *p; p = strchr( dn->bv_val, ',' ); /* one-level dn */ if ( p == NULL ) { - pdn->bv_val = ""; - pdn->bv_len = 0; + *pdn = slap_empty_bv; return LDAP_SUCCESS; } @@ -645,8 +644,7 @@ dn_parent( Backend *be, const char *dn ) { - const char *pdn; - struct berval bv; + struct berval bv, pdn; if ( dn == NULL ) { return NULL; @@ -660,17 +658,17 @@ dn_parent( return NULL; } - bv.bv_val = dn; + bv.bv_val = (char *)dn; bv.bv_len = strlen(bv.bv_val); if ( be != NULL && be_issuffix( be, &bv ) ) { return NULL; } - if ( dnParent( dn, &pdn ) != LDAP_SUCCESS ) { + if ( dnParent( &bv, &pdn ) != LDAP_SUCCESS ) { return NULL; } - return ( char * )pdn; + return pdn.bv_val; } #endif /* SLAP_DN_MIGRATION */ -- 2.39.5