Blob Blame Raw
From f6f6340afaea6f26d188f875b15f966e03cb7f50 Mon Sep 17 00:00:00 2001
From: Thierry Bordaz <tbordaz@redhat.com>
Date: Mon, 18 Jul 2016 18:30:28 +0200
Subject: [PATCH 17/29] Ticket 48928 log of page result cookie should log empty
 cookie with a different value than 0

Bug Description:
    With the ticket https://fedorahosted.org/389/ticket/48752, the cookie value
    is logged with each page result RESULT.
    When the page result is completed (no more entry to return), the returned cookie is 'pr_cookie=0'.
    Else the cookie value is logged 'pr_cookie=<internal index>'. Unfortunately the index ranges [0..N].

    So when the value pr_cookie=0 is logged, it is not possible to know if it is an empty cookie or a valid cookie with the value 0.

Fix Description:
    Log the empty cookie with a value '-1'

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

Reviewed by: Noriko Hosoi, Simon Pichugin (thanks !!!!)

Platforms tested: F23

Flag Day: no

Doc impact: no

(cherry picked from commit 73ff835f29514e33433de9f2be74f73efe6943ce)
---
 ldap/servers/slapd/pagedresults.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index 07a7b69..6fec344 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -247,7 +247,7 @@ pagedresults_set_response_control( Slapi_PBlock *pb, int iscritical,
 
     /* begin sequence, payload, end sequence */
     if (current_search_count < 0) {
-        cookie = 0;
+        cookie = -1;
         cookie_str = slapi_ch_strdup("");
     } else {
         cookie = index;
-- 
2.4.11