From: Vsevolod Stakhov Date: Thu, 31 Jul 2025 15:51:46 +0000 (+0100) Subject: [Fix] Check skip_hashes for the returned hashes X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F5556%2Fhead;p=thirdparty%2Frspamd.git [Fix] Check skip_hashes for the returned hashes --- diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 58d123712d..d6836df3bd 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -1386,6 +1386,20 @@ rspamd_fuzzy_check_callback(struct rspamd_fuzzy_reply *result, void *ud) } } + /* Check if the returned hash from fuzzy matching should be skipped */ + if (session->ctx->skip_hashes && result->v1.value > 0) { + char hexbuf[sizeof(result->digest) * 2 + 1]; + rspamd_encode_hex_buf(result->digest, sizeof(result->digest), + hexbuf, sizeof(hexbuf) - 1); + hexbuf[sizeof(hexbuf) - 1] = '\0'; + + if (rspamd_match_hash_map(session->ctx->skip_hashes, + hexbuf, sizeof(hexbuf) - 1)) { + result->v1.value = 401; + result->v1.prob = 0.0f; + } + } + if (!isnan(session->ctx->delay) && rspamd_match_radix_map_addr(session->ctx->delay_whitelist, session->addr) == NULL) {