]> git.proxmox.com Git - pmg-api.git/commitdiff
make ldap paging working again
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 19 Oct 2017 12:36:19 +0000 (14:36 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 19 Oct 2017 13:37:40 +0000 (15:37 +0200)
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 <d.csapak@proxmox.com>
PMG/LDAPCache.pm

index f45d61b87f0250bfacc4226bccaaada8d5cf30e1..9d65010b7785094ae029a545d118e0ac5fad44ca 100755 (executable)
@@ -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);