improve pagedResults ignoring (hopefully)

This commit is contained in:
Pierangelo Masarati 2004-06-16 15:26:21 +00:00
parent f78611bf5e
commit a317f01dc1
4 changed files with 23 additions and 7 deletions

View 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 );

View 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;
}

View 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;

View 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