Blob Blame Raw
From debd7eeaa129d176c14e6e9d45a9c302c0b508a7 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@redhat.com>
Date: Fri, 27 Sep 2013 11:23:42 -0700
Subject: [PATCH 19/28] Ticket #47534 - RUV tombstone search with scope "one" doesn`t work

Bug description: slapi_sdn_scope_test_ext examines the given dn
satisfies the scope against the base dn.  Onelevel case for the
tombstone DN ignores the nsuniqueid leaf rdn before checking the
scope which should not be done for the RUV tombstone.

Fix description: This patch correctly handles the RUV tombstone
as an exception.

https://fedorahosted.org/389/ticket/47534

Reviewed by rmeggins (Thanks, Rich!)
(cherry picked from commit fbece32d94515bc1ca3889c3d7c0691bbeec3ab0)
(cherry picked from commit a8795a928511321f3b46461680cfbf8314edc982)
---
 ldap/servers/slapd/dn.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index 9ed8091..9530b84 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -2645,7 +2645,10 @@ slapi_sdn_scope_test_ext( const Slapi_DN *dn, const Slapi_DN *base, int scope, i
         }
         break;
     case LDAP_SCOPE_ONELEVEL:
-        if (flags & SLAPI_ENTRY_FLAG_TOMBSTONE) {
+#define RUVRDN SLAPI_ATTR_UNIQUEID "=" RUV_STORAGE_ENTRY_UNIQUEID ","
+        if ((flags & SLAPI_ENTRY_FLAG_TOMBSTONE) &&
+            (strncmp(slapi_sdn_get_ndn(dn), RUVRDN, sizeof(RUVRDN) - 1))) {
+            /* tombstones except RUV tombstone */
             Slapi_DN parent;
             slapi_sdn_init(&parent);
             slapi_sdn_get_parent(dn, &parent);
-- 
1.7.1