mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
implement server side of "max" limit
This commit is contained in:
parent
b1a1f0b8b6
commit
7e833d90a7
@ -1027,7 +1027,10 @@ limits_check( Operation *op, SlapReply *rs )
|
||||
}
|
||||
|
||||
} else if ( op->ors_limit->lms_t_hard > 0 ) {
|
||||
if ( op->ors_tlimit < 0 || op->ors_tlimit > op->ors_limit->lms_t_hard ) {
|
||||
if ( op->ors_tlimit == SLAP_MAX_LIMIT ) {
|
||||
op->ors_tlimit = op->ors_limit->lms_t_hard;
|
||||
|
||||
} else if ( op->ors_tlimit < 0 || op->ors_tlimit > op->ors_limit->lms_t_hard ) {
|
||||
/* error if exceeding hard limit */
|
||||
rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
|
||||
send_ldap_result( op, rs );
|
||||
@ -1084,7 +1087,9 @@ limits_check( Operation *op, SlapReply *rs )
|
||||
if ( pr_total == -1 ) {
|
||||
slimit = -1;
|
||||
|
||||
} else if ( pr_total > 0 && ( op->ors_slimit == SLAP_NO_LIMIT || op->ors_slimit > pr_total ) ) {
|
||||
} else if ( pr_total > 0 && op->ors_slimit != SLAP_MAX_LIMIT
|
||||
&& ( op->ors_slimit == SLAP_NO_LIMIT || op->ors_slimit > pr_total ) )
|
||||
{
|
||||
rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
|
||||
send_ldap_result( op, rs );
|
||||
rs->sr_err = LDAP_SUCCESS;
|
||||
@ -1097,8 +1102,11 @@ limits_check( Operation *op, SlapReply *rs )
|
||||
|
||||
/* first round of pagedResults: set count to any appropriate limit */
|
||||
|
||||
/* if the limit is set, check that it does not violate any limit */
|
||||
if ( op->ors_slimit > 0 ) {
|
||||
/* if the limit is set, check that it does not violate any server-side limit */
|
||||
if ( op->ors_slimit == SLAP_MAX_LIMIT ) {
|
||||
slimit2 = op->ors_slimit = pr_total;
|
||||
|
||||
} else if ( op->ors_slimit > 0 ) {
|
||||
slimit2 = op->ors_slimit;
|
||||
|
||||
} else if ( op->ors_slimit == 0 ) {
|
||||
@ -1173,7 +1181,10 @@ limits_check( Operation *op, SlapReply *rs )
|
||||
|
||||
/* explicit hard limit: error if violated */
|
||||
} else if ( op->ors_limit->lms_s_hard > 0 ) {
|
||||
if ( op->ors_slimit > op->ors_limit->lms_s_hard ) {
|
||||
if ( op->ors_slimit == SLAP_MAX_LIMIT ) {
|
||||
op->ors_slimit = op->ors_limit->lms_s_hard;
|
||||
|
||||
} else if ( op->ors_slimit > op->ors_limit->lms_s_hard ) {
|
||||
/* if limit exceeds hard, error */
|
||||
rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
|
||||
send_ldap_result( op, rs );
|
||||
|
@ -1314,6 +1314,7 @@ struct slap_limits_set {
|
||||
|
||||
/* Note: this is different from LDAP_NO_LIMIT (0); slapd internal use only */
|
||||
#define SLAP_NO_LIMIT -1
|
||||
#define SLAP_MAX_LIMIT 2147483647
|
||||
|
||||
struct slap_limits {
|
||||
unsigned lm_flags; /* type of pattern */
|
||||
|
Loading…
Reference in New Issue
Block a user