Blame SOURCES/0078-Ticket-48375-SimplePagedResults-in-the-search-error-.patch

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