]> git.sur5r.net Git - openldap/commitdiff
improve pagedResults ignoring (hopefully)
authorPierangelo Masarati <ando@openldap.org>
Wed, 16 Jun 2004 15:26:21 +0000 (15:26 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 16 Jun 2004 15:26:21 +0000 (15:26 +0000)
servers/slapd/back-bdb/search.c
servers/slapd/controls.c
servers/slapd/limits.c
servers/slapd/slap.h

index 3d20894bdefda30c7f437cda0da98164b5a708b2..2737d1fb826d1e29e3bf0bb0e341fe779a1e9316 100644 (file)
@@ -754,7 +754,7 @@ dn2entry_retry:
                tentries = BDB_IDL_N(candidates);
        }
 
-       if ( get_pagedresults(sop) ) {
+       if ( get_pagedresults(sop) > SLAP_NO_CONTROL ) {
                if ( (ID)( sop->o_pagedresults_state.ps_cookie ) == 0 ) {
                        id = bdb_idl_first( candidates, &cursor );
 
@@ -1133,7 +1133,7 @@ id2entry_retry:
                                goto done;
                        }
 
-                       if ( get_pagedresults(sop) ) {
+                       if ( get_pagedresults(sop) > SLAP_NO_CONTROL ) {
                                if ( rs->sr_nentries >= sop->o_pagedresults_size ) {
                                        send_paged_response( sop, rs, &lastid, tentries );
                                        goto done;
@@ -1456,7 +1456,7 @@ nochange:
                        rs->sr_ref = rs->sr_v2ref;
                        rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
                        rs->sr_rspoid = NULL;
-                       if ( get_pagedresults(sop) ) {
+                       if ( get_pagedresults(sop) > SLAP_NO_CONTROL ) {
                                send_paged_response( sop, rs, NULL, 0 );
                        } else {
                                send_ldap_result( sop, rs );
index c010122a91b9e93ea9501d1cf7b439e61f6a479d..db981a9a8c377c26796d2fcb1a16b0384bbd1e79 100644 (file)
@@ -918,9 +918,24 @@ static int parsePagedResults (
 
        op->o_pagedresults_size = size;
 
-       op->o_pagedresults = ctrl->ldctl_iscritical
-               ? SLAP_CRITICAL_CONTROL
-               : SLAP_NONCRITICAL_CONTROL;
+       /* NOTE: according to RFC 2696 3.:
+
+    If the page size is greater than or equal to the sizeLimit value, the
+    server should ignore the control as the request can be satisfied in a
+    single page.
+        
+        * NOTE: this assumes that the op->ors_slimit be set
+        * before the controls are parsed.     
+        */
+       if ( op->ors_slimit > 0 && size >= op->ors_slimit ) {
+               op->o_pagedresults = SLAP_IGNORED_CONTROL;
+
+       } else if ( ctrl->ldctl_iscritical ) {
+               op->o_pagedresults = SLAP_CRITICAL_CONTROL;
+
+       } else {
+               op->o_pagedresults = SLAP_NONCRITICAL_CONTROL;
+       }
 
        return LDAP_SUCCESS;
 }
index 836b4624b5c337f7b227ac42adfe23e2340c4b6c..b32ea0be77a63f5cfbb08f054a9838c1a9402207 100644 (file)
@@ -1048,7 +1048,7 @@ limits_check( Operation *op, SlapReply *rs )
                }
 
                /* if paged results is requested */     
-               if ( get_pagedresults( op ) ) {
+               if ( get_pagedresults( op ) > SLAP_NO_CONTROL ) {
                        int     slimit = -2;
                        int     pr_total;
 
index 7c7f33b463e3bc9a2094da26fbaa3618350aae51..293c3cb79c84836cce6016c0d0c1e71f1b10c8df 100644 (file)
@@ -2072,6 +2072,7 @@ typedef struct slap_op {
        char o_do_not_cache;    /* don't cache groups from this op */
        char o_is_auth_check;   /* authorization in progress */
 
+#define SLAP_IGNORED_CONTROL -1
 #define SLAP_NO_CONTROL 0
 #define SLAP_NONCRITICAL_CONTROL 1
 #define SLAP_CRITICAL_CONTROL 2