]> git.sur5r.net Git - openldap/commitdiff
ITS#5409 must reset pagedresults state if no cookie is provided
authorHoward Chu <hyc@openldap.org>
Wed, 9 Apr 2008 03:08:38 +0000 (03:08 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 9 Apr 2008 03:08:38 +0000 (03:08 +0000)
servers/slapd/back-bdb/search.c
servers/slapd/controls.c

index abe130f5502f1319867ed83137efb3a7278b09a4..3bbe0a7abcfd7185c801a114088f88d32378ff59 100644 (file)
@@ -1160,10 +1160,6 @@ parse_paged_cookie( Operation *op, SlapReply *rs )
                        goto done;
                }
 
-       } else {
-               /* Initial request.  Initialize state. */
-               ps->ps_cookie = 0;
-               ps->ps_count = 0;
        }
 
 done:;
index b7f66eeab2faa2a1aa441295f814b7f40bc1a65b..042fccca8f080fabb569356d14c6a37ff3e59bc8 100644 (file)
@@ -1102,6 +1102,10 @@ static int parsePagedResults (
        ps->ps_size = size;
        ps->ps_cookieval = cookie;
        op->o_pagedresults_state = ps;
+       if ( !cookie.bv_len ) {
+               ps->ps_count = 0;
+               ps->ps_cookie = 0;
+       }
 
        /* NOTE: according to RFC 2696 3.: