From: Ralph Boehme Date: Thu, 20 Apr 2023 15:58:38 +0000 (+0200) Subject: mdssvc: fix enforcement of "elasticsearch:max results" X-Git-Tag: ldb-2.8.0~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d8fa5c8e2a1794ea8dc663485315ebd9401b2628;p=thirdparty%2Fsamba.git mdssvc: fix enforcement of "elasticsearch:max results" This wasn't enforced at all thus a query would return all available matches without limit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15342 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/rpc_server/mdssvc/mdssvc_es.c b/source3/rpc_server/mdssvc/mdssvc_es.c index c240a538169..8460b48b80a 100644 --- a/source3/rpc_server/mdssvc/mdssvc_es.c +++ b/source3/rpc_server/mdssvc/mdssvc_es.c @@ -800,7 +800,7 @@ static void mds_es_search_http_read_done(struct tevent_req *subreq) } DBG_DEBUG("Hits: %zu\n", hits); - for (i = 0; i < hits; i++) { + for (i = 0; i < hits && s->from + i < s->max; i++) { const char *path = NULL; match = json_array_get(matches, i);