]> git.sur5r.net Git - openldap/commitdiff
Fix slapi_dn_beparent() behaviour (again)
authorLuke Howard <lukeh@openldap.org>
Sun, 31 Jul 2005 14:17:36 +0000 (14:17 +0000)
committerLuke Howard <lukeh@openldap.org>
Sun, 31 Jul 2005 14:17:36 +0000 (14:17 +0000)
servers/slapd/slapi/slapi_utils.c

index 1b65c54d8f2962a951113d084586ae0f98b16d20..46173593185903a6081a93acdc7e8a4d35ea9382 100644 (file)
@@ -952,6 +952,8 @@ char *slapi_dn_beparent( Slapi_PBlock *pb, const char *_dn )
                return NULL;
        }
 
+       PBLOCK_ASSERT_OP( pb, 0 );
+
        if ( slapi_is_rootdse( _dn ) ) {
                return NULL;
        }
@@ -963,7 +965,7 @@ char *slapi_dn_beparent( Slapi_PBlock *pb, const char *_dn )
                return NULL;
        }
 
-       be = select_backend( &dn, 0, 0 );
+       be = select_backend( &pb->pb_op->o_req_ndn, 0, 0 );
 
        if ( be == NULL || be_issuffix( be, &normalizedDN ) == 0 ) {
                dnParent( &prettyDN, &parentDN );
@@ -972,8 +974,8 @@ char *slapi_dn_beparent( Slapi_PBlock *pb, const char *_dn )
                        parent = slapi_ch_strdup( parentDN.bv_val );
        }
 
-       slapi_ch_free( (void **)&prettyDN.bv_val );
-       slapi_ch_free( (void **)&normalizedDN.bv_val );
+       slapi_ch_free_string( &prettyDN.bv_val );
+       slapi_ch_free_string( &normalizedDN.bv_val );
 
        return parent;
 }