From: Howard Chu Date: Wed, 21 Jan 2004 10:25:41 +0000 (+0000) Subject: ITS#2888 once more, fix sizelimit propagation X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=54453690f6acbe8f4cf2c2edb07f85e905ab1e9f;p=openldap ITS#2888 once more, fix sizelimit propagation --- diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 6185ed77f9..c75bd2eb25 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -179,7 +179,6 @@ glue_back_db_destroy ( typedef struct glue_state { int err; - int is_slimit; int slimit; int matchlen; char *matched; @@ -194,7 +193,7 @@ glue_back_response ( Operation *op, SlapReply *rs ) switch(rs->sr_type) { case REP_SEARCH: - if ( gs->is_slimit && rs->sr_nentries >= gs->slimit ) { + if ( gs->slimit && rs->sr_nentries >= gs->slimit ) { gs->err = LDAP_SIZELIMIT_EXCEEDED; return -1; } @@ -203,14 +202,12 @@ glue_back_response ( Operation *op, SlapReply *rs ) return SLAP_CB_CONTINUE; default: - if ( gs->is_slimit && rs->sr_err == LDAP_SIZELIMIT_EXCEEDED - && rs->sr_nentries >= gs->slimit ) { - gs->err = LDAP_SIZELIMIT_EXCEEDED; - return -1; - } - if (rs->sr_err == LDAP_SUCCESS || gs->err != LDAP_SUCCESS) { + if (rs->sr_err == LDAP_SUCCESS || + rs->sr_err == LDAP_SIZELIMIT_EXCEEDED || + rs->sr_err == LDAP_TIMELIMIT_EXCEEDED || + rs->sr_err == LDAP_ADMINLIMIT_EXCEEDED || + gs->err != LDAP_SUCCESS) gs->err = rs->sr_err; - } if (gs->err == LDAP_SUCCESS && gs->matched) { ch_free (gs->matched); gs->matched = NULL; @@ -257,13 +254,11 @@ glue_back_search ( Operation *op, SlapReply *rs ) glueinfo *gi = (glueinfo *) b0->bd_info; int i; long stoptime = 0; - glue_state gs = {0, 0, 0, 0, NULL, 0, NULL}; + glue_state gs = {0, 0, 0, NULL, 0, NULL}; slap_callback cb = { NULL, glue_back_response, NULL, NULL }; int scope0, slimit0, tlimit0; struct berval dn, ndn; - gs.is_slimit = ( op->ors_slimit > 0 ); - cb.sc_private = &gs; cb.sc_next = op->o_callback; @@ -290,9 +285,7 @@ glue_back_search ( Operation *op, SlapReply *rs ) op->o_callback = &cb; rs->sr_err = gs.err = LDAP_UNWILLING_TO_PERFORM; scope0 = op->ors_scope; - if ( gs.is_slimit ) { - slimit0 = gs.slimit = op->ors_slimit; - } + slimit0 = gs.slimit = op->ors_slimit; tlimit0 = op->ors_tlimit; dn = op->o_req_dn; ndn = op->o_req_ndn; @@ -310,7 +303,7 @@ glue_back_search ( Operation *op, SlapReply *rs ) break; } } - if ( gs.is_slimit ) { + if (slimit0) { op->ors_slimit = slimit0 - rs->sr_nentries; if (op->ors_slimit < 0) { rs->sr_err = gs.err = LDAP_SIZELIMIT_EXCEEDED; @@ -365,9 +358,7 @@ glue_back_search ( Operation *op, SlapReply *rs ) } end_of_loop:; op->ors_scope = scope0; - if ( gs.is_slimit ) { - op->ors_slimit = slimit0; - } + op->ors_slimit = slimit0; op->ors_tlimit = tlimit0; op->o_req_dn = dn; op->o_req_ndn = ndn;