andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 7b35b724f8a874a200154d1e3626ed14cc5b8245 Mon Sep 17 00:00:00 2001
dc8c34
From: Ludwig Krispenz <lkrispen@redhat.com>
dc8c34
Date: Mon, 24 Jun 2013 10:19:53 +0200
dc8c34
Subject: [PATCH 73/99] Ticket 47396 - crash on modrdn of tombstone
dc8c34
dc8c34
    Bug Description:  a client modrdn operation on a tombstone entry can crash the server
dc8c34
dc8c34
    Fix Description:   client modrdns and modifies on tombstone entries should not be
dc8c34
        accepted. Tombstones aer internally kept for eventual conflict resolution, normal
dc8c34
        clients should not touch them.
dc8c34
        an exception would be to force purging of tombstones or a kind of "undo" for
dc8c34
        a delete, which could resurrect a tombstone, but this is not in the scope of this ticket
dc8c34
dc8c34
    https://fedorahosted.org/389/ticket/47396
dc8c34
dc8c34
    Reviewed by: Rich, thanks
dc8c34
(cherry picked from commit d1d6245d6ab894cf56e2529cb5c5dc941f4843cd)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 7 +++++++
dc8c34
 1 file changed, 7 insertions(+)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
dc8c34
index b5cb90b..c539463 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
dc8c34
@@ -352,6 +352,13 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
dc8c34
         goto error_return; /* error result sent by find_entry2modify() */
dc8c34
     }
dc8c34
     e_in_cache = 1; /* e is in the cache and locked */
dc8c34
+    if (slapi_entry_flag_is_set(e->ep_entry, SLAPI_ENTRY_FLAG_TOMBSTONE) ) {
dc8c34
+        ldap_result_code = LDAP_UNWILLING_TO_PERFORM;
dc8c34
+        ldap_result_message = "Operation not allowed on tombstone entry.";
dc8c34
+        slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_modrdn",
dc8c34
+               "Attempt to rename a tombstone entry %s\n", slapi_sdn_get_dn(slapi_entry_get_sdn_const( e->ep_entry )));
dc8c34
+        goto error_return;
dc8c34
+    }
dc8c34
     /* Check that an entry with the same DN doesn't already exist. */
dc8c34
     {
dc8c34
         Slapi_Entry *entry;
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34