andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 7445376fead6c7af36794fd757c5a5298cda77cb Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Wed, 9 Dec 2015 12:05:24 -0800
dc8c34
Subject: [PATCH 370/370] Ticket #48375 - SimplePagedResults -- in the search
dc8c34
 error case, simple paged results slot was not released.
dc8c34
dc8c34
Description: If a simple paged results search fails in the backend,
dc8c34
the simple paged results slot was not released.  This patch adds it.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/48375
dc8c34
dc8c34
Reviewed by tbordaz@redhat.com (Thank you, Thierry!!)
dc8c34
dc8c34
(cherry picked from commit 5a54717bfa40e3ef987bd85c5806125e49b2b278)
dc8c34
(cherry picked from commit b91aad03b660aea85cb745554f27101c690f8402)
dc8c34
(cherry picked from commit 44acc45e3c525b997f46cac06f9723694634a131)
dc8c34
(cherry picked from commit 826513851fad77bd524af7271846c8f048eedc2d)
dc8c34
---
dc8c34
 ldap/servers/slapd/opshared.c | 21 ++++++++++++++++-----
dc8c34
 1 file changed, 16 insertions(+), 5 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
dc8c34
index 391d1c3..e73ac6e 100644
dc8c34
--- a/ldap/servers/slapd/opshared.c
dc8c34
+++ b/ldap/servers/slapd/opshared.c
dc8c34
@@ -839,15 +839,26 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
dc8c34
              * wait the end of the loop to send back this error 
dc8c34
              */
dc8c34
             flag_no_such_object = 1;
dc8c34
-            break;
dc8c34
+        } else {
dc8c34
+            /* err something other than LDAP_NO_SUCH_OBJECT, so the backend will
dc8c34
+             * have sent the result -
dc8c34
+             * Set a flag here so we don't return another result. */
dc8c34
+            sent_result = 1;
dc8c34
         }
dc8c34
-        /* err something other than LDAP_NO_SUCH_OBJECT, so the backend will
dc8c34
-         * have sent the result -
dc8c34
-         * Set a flag here so we don't return another result. */
dc8c34
-        sent_result = 1;
dc8c34
         /* fall through */
dc8c34
   
dc8c34
       case -1:    /* an error occurred */            
dc8c34
+        /* PAGED RESULTS */
dc8c34
+        if (op_is_pagedresults(operation)) {
dc8c34
+            /* cleanup the slot */
dc8c34
+            PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+            pagedresults_set_search_result(pb->pb_conn, operation, NULL, 1, pr_idx);
dc8c34
+            rc = pagedresults_set_current_be(pb->pb_conn, NULL, pr_idx, 1);
dc8c34
+            PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+        }
dc8c34
+        if (1 == flag_no_such_object) {
dc8c34
+            break;
dc8c34
+        }
dc8c34
         slapi_pblock_get(pb, SLAPI_RESULT_CODE, &err;;
dc8c34
         if (err == LDAP_NO_SUCH_OBJECT)
dc8c34
         {
dc8c34
-- 
dc8c34
2.4.3
dc8c34