aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2025-07-31 16:51:46 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2025-07-31 16:51:46 +0100
commit23ed80bf787ec9e44caa4db79aee697b934c0a2d (patch)
tree70dd849425b6274709a032b3fcf336fa4da63aca
parent0a1b5449fc3d709a20ce0ecc552b5a5c8ff8f45e (diff)
downloadrspamd-vstakhov-skip-hashes-fuzzy.tar.gz
rspamd-vstakhov-skip-hashes-fuzzy.zip
[Fix] Check skip_hashes for the returned hashesvstakhov-skip-hashes-fuzzy
-rw-r--r--src/fuzzy_storage.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 58d123712..d6836df3b 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) {