]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/limits.c
ITS#5379 HAVE_TLS dependency
[openldap] / servers / slapd / limits.c
index 81f4027de36dceb52a2510dfacb0c4da98b6b0ed..17e131e1c8c73eb4ffb2205ecf426071d4dc0f7f 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2007 The OpenLDAP Foundation.
+ * Copyright 1998-2008 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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 );