andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From c038959812a2e7d92285fc9d304e1dae99a8cfa4 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@totoro.usersys.redhat.com>
dc8c34
Date: Wed, 14 Nov 2012 12:23:06 -0800
dc8c34
Subject: [PATCH 14/16] Trac Ticket #520 - RedHat Directory Server crashes
dc8c34
 (segfaults) when moving ldap entry
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/520
dc8c34
dc8c34
Fix description: The code to check if the new superior entry exists
dc8c34
or not was returning the "No such object" error only when the op
dc8c34
was requested by the directory manager.  This patch is removing
dc8c34
the condition so that whoever the requester is, it returns the error.
dc8c34
(cherry picked from commit 40e68b18dae23a21654719a742419f172aa54806)
dc8c34
(cherry picked from commit d4dbb3d01a7f3f39c5370a10a02109d90c5140e0)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 11 ++++++-----
dc8c34
 1 file changed, 6 insertions(+), 5 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
dc8c34
index c7d821a..69fc053 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
dc8c34
@@ -426,10 +426,11 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
dc8c34
     if ( newparententry == NULL )
dc8c34
     {
dc8c34
         /* There may not be a new parent because we don't intend there to be one. */
dc8c34
-        if(slapi_sdn_get_ndn(dn_newsuperiordn)!=NULL)
dc8c34
+        if (slapi_sdn_get_ndn(dn_newsuperiordn))
dc8c34
         {
dc8c34
-            /* If the new entry is to be a suffix, and we're root, then it's OK that the new parent doesn't exist */
dc8c34
-            if (!(slapi_be_issuffix(pb->pb_backend, &dn_newdn)) && isroot)
dc8c34
+            /* If the new entry is not to be a suffix, 
dc8c34
+             * return an error no matter who requested this modrdn */
dc8c34
+            if (!slapi_be_issuffix(pb->pb_backend, &dn_newdn))
dc8c34
             {
dc8c34
                 /* Here means that we didn't find the parent */
dc8c34
                 int err = 0;
dc8c34
@@ -447,7 +448,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
dc8c34
                             slapi_sdn_get_ndn(dn_newsuperiordn), 0 );
dc8c34
                 slapi_sdn_done(&ancestorsdn);
dc8c34
                 goto error_return;
dc8c34
-               }
dc8c34
+            }
dc8c34
         }
dc8c34
     }
dc8c34
     else
dc8c34
@@ -465,7 +466,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
dc8c34
     if ( parententry == NULL )
dc8c34
     {
dc8c34
         /* If the entry a suffix, and we're root, then it's OK that the parent doesn't exist */
dc8c34
-        if (!(slapi_be_issuffix(pb->pb_backend, sdn)) && isroot)
dc8c34
+        if (!(slapi_be_issuffix(pb->pb_backend, sdn)) && !isroot)
dc8c34
         {
dc8c34
             /* Here means that we didn't find the parent */
dc8c34
             ldap_result_matcheddn = "NULL";
dc8c34
-- 
dc8c34
1.7.11.7
dc8c34