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