From 8a55795fbe18ad17f94ed4ed058c6806c32f38b4 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 13 Feb 2004 02:44:13 +0000 Subject: [PATCH] ITS#2888 fix back-ldap to check result of send_search_entry. Make sure sizelimit errors are propagated. --- servers/slapd/back-ldap/search.c | 11 ++++++++--- servers/slapd/backglue.c | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 4dd6d8ccde..5c8ec754e9 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -218,12 +218,13 @@ fail:; } else if (rc == LDAP_RES_SEARCH_ENTRY) { Entry ent = {0}; struct berval bdn; + int abort = 0; e = ldap_first_entry(lc->ld,res); - if ( ldap_build_entry(op, e, &ent, &bdn, - LDAP_BUILD_ENTRY_PRIVATE) == LDAP_SUCCESS ) { + if ( ( rc = ldap_build_entry(op, e, &ent, &bdn, + LDAP_BUILD_ENTRY_PRIVATE)) == LDAP_SUCCESS ) { rs->sr_entry = &ent; rs->sr_attrs = op->oq_search.rs_attrs; - send_search_entry( op, rs ); + abort = send_search_entry( op, rs ); while (ent.e_attrs) { Attribute *a; BerVarray v; @@ -245,6 +246,10 @@ fail:; free( ent.e_ndn ); } ldap_msgfree(res); + if ( abort ) { + ldap_abandon(lc->ld, msgid); + goto finish; + } } else if ( rc == LDAP_RES_SEARCH_REFERENCE ) { char **references = NULL; diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index c75bd2eb25..669f8525f1 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -194,7 +194,7 @@ glue_back_response ( Operation *op, SlapReply *rs ) switch(rs->sr_type) { case REP_SEARCH: if ( gs->slimit && rs->sr_nentries >= gs->slimit ) { - gs->err = LDAP_SIZELIMIT_EXCEEDED; + rs->sr_err = gs->err = LDAP_SIZELIMIT_EXCEEDED; return -1; } /* fallthru */ -- 2.39.5