]> git.sur5r.net Git - openldap/commitdiff
Fix previous commit
authorHoward Chu <hyc@openldap.org>
Sat, 26 Jan 2002 06:52:11 +0000 (06:52 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 26 Jan 2002 06:52:11 +0000 (06:52 +0000)
servers/slapd/dn.c

index 5068a0461575fc51f1602fa5b1a4c41cb7c2fba8..7d836a630e43c424e0275c1c161c27a1ab7de901 100644 (file)
@@ -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 */