From 67390b83019856786e9e522f8724825823aa95c4 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Thu, 19 Oct 2017 14:36:19 +0200 Subject: [PATCH] make ldap paging working again the cookie can be defined but 0, so we need to check it like this (the code is taken from the documentation of Net::LDAP::Control::Paged) Signed-off-by: Dominik Csapak --- PMG/LDAPCache.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PMG/LDAPCache.pm b/PMG/LDAPCache.pm index f45d61b..9d65010 100755 --- a/PMG/LDAPCache.pm +++ b/PMG/LDAPCache.pm @@ -239,14 +239,16 @@ sub queryusers { # Get cookie from paged control my ($resp) = $mesg->control(LDAP_CONTROL_PAGED) or last; - $cookie = $resp->cookie or last; + $cookie = $resp->cookie; + + last if (!defined($cookie) || !length($cookie)); # Set cookie in paged control $page->cookie($cookie); } - if ($cookie) { + if (defined($cookie) && length($cookie)) { # We had an abnormal exit, so let the server know we do not want any more $page->cookie($cookie); $page->size(0); -- 2.39.2