]> git.sur5r.net Git - openldap/commitdiff
ITS#5230 fix slimit for rootDN w/pagedresults
authorHoward Chu <hyc@openldap.org>
Mon, 12 Nov 2007 08:14:50 +0000 (08:14 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 12 Nov 2007 08:14:50 +0000 (08:14 +0000)
servers/slapd/limits.c

index 81f4027de36dceb52a2510dfacb0c4da98b6b0ed..5fbda3008c67ebcc3c519d84e7f507036913121d 100644 (file)
@@ -1118,6 +1118,18 @@ limits_check( Operation *op, SlapReply *rs )
                        op->ors_slimit = SLAP_NO_LIMIT;
                }
 
+               /* if paged results and slimit are requested */ 
+               if ( get_pagedresults( op ) > SLAP_CONTROL_IGNORED &&
+                       op->ors_slimit != SLAP_NO_LIMIT ) {
+                       PagedResultsState *ps = op->o_pagedresults_state;
+                       int total = op->ors_slimit - ps->ps_count;
+                       if ( total > 0 ) {
+                               op->ors_slimit = total;
+                       } else {
+                               op->ors_slimit = 0;
+                       }
+               }
+
        /* if not root, get appropriate limits */
        } else {
                ( void ) limits_get( op, &op->o_ndn, &op->ors_limit );