]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
mdssvc: fix enforcement of "elasticsearch:max results"
authorRalph Boehme <slow@samba.org>
Thu, 20 Apr 2023 15:58:38 +0000 (17:58 +0200)
committerJule Anger <janger@samba.org>
Mon, 31 Jul 2023 08:08:13 +0000 (08:08 +0000)
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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit d8fa5c8e2a1794ea8dc663485315ebd9401b2628)

source3/rpc_server/mdssvc/mdssvc_es.c

index c240a5381695ba84e74863e497df2142be835a2c..8460b48b80aaab30cb7aa97e2cde8200f27d1de2 100644 (file)
@@ -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);