]> git.sur5r.net Git - openldap/commitdiff
Allow slapi_sdn_get_parent() to work if only normalized DN is available
authorLuke Howard <lukeh@openldap.org>
Wed, 24 Aug 2005 05:11:58 +0000 (05:11 +0000)
committerLuke Howard <lukeh@openldap.org>
Wed, 24 Aug 2005 05:11:58 +0000 (05:11 +0000)
servers/slapd/slapi/slapi_dn.c

index 4cb4b361a0ab61e98db0ba394599329eb32dc13f..477eb0afe6d427e53fe5f635d74433c5cb2d381b 100644 (file)
@@ -215,9 +215,13 @@ void slapi_sdn_get_parent( const Slapi_DN *sdn, Slapi_DN *sdn_parent )
 {
        struct berval parent_dn;
 
-       dnParent( (struct berval *)&sdn->dn, &parent_dn );
-
-       slapi_sdn_set_dn_byval( sdn_parent, parent_dn.bv_val );
+       if ( !(sdn->flag & FLAG_DN) ) {
+               dnParent( (struct berval *)&sdn->ndn, &parent_dn );
+               slapi_sdn_set_ndn_byval( sdn_parent, parent_dn.bv_val );
+       } else {
+               dnParent( (struct berval *)&sdn->dn, &parent_dn );
+               slapi_sdn_set_dn_byval( sdn_parent, parent_dn.bv_val );
+       }
 }
 
 void slapi_sdn_get_backend_parent( const Slapi_DN *sdn,