aboutsummaryrefslogtreecommitdiffstats
path: root/src/fuzzy_storage.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-04-08 22:05:14 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-04-08 22:05:14 +0100
commitad2d27ce7f1f66feb4d8e24cadb75da8486848b1 (patch)
tree1ec036a0e968441d5785e17da676ff4b3bfb2436 /src/fuzzy_storage.c
parent216266fde8d7ff6830d18ab54695edd358bb1013 (diff)
downloadrspamd-ad2d27ce7f1f66feb4d8e24cadb75da8486848b1.tar.gz
rspamd-ad2d27ce7f1f66feb4d8e24cadb75da8486848b1.zip
[Minor] Fix include/exclude policy
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r--src/fuzzy_storage.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 7d19b6d2d..a6d8be896 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -783,6 +783,8 @@ rspamd_fuzzy_make_reply (struct rspamd_fuzzy_cmd *cmd,
session->reply.rep.v1.value = 0;
}
+ bool default_disabled = false;
+
{
khiter_t k;
@@ -790,10 +792,7 @@ rspamd_fuzzy_make_reply (struct rspamd_fuzzy_cmd *cmd,
if (k != kh_end(session->ctx->default_forbidden_ids)) {
/* Hash is from a forbidden flag by default */
- session->reply.rep.ts = 0;
- session->reply.rep.v1.prob = 0.0f;
- session->reply.rep.v1.value = 0;
- session->reply.rep.v1.flag = 0;
+ default_disabled = true;
}
}
@@ -812,6 +811,13 @@ rspamd_fuzzy_make_reply (struct rspamd_fuzzy_cmd *cmd,
session->reply.rep.v1.flag = 0;
}
}
+ else if (default_disabled) {
+ /* Hash is from a forbidden flag by default */
+ session->reply.rep.ts = 0;
+ session->reply.rep.v1.prob = 0.0f;
+ session->reply.rep.v1.value = 0;
+ session->reply.rep.v1.flag = 0;
+ }
/* We need also to encrypt reply */
ottery_rand_bytes (session->reply.hdr.nonce,
@@ -836,6 +842,13 @@ rspamd_fuzzy_make_reply (struct rspamd_fuzzy_cmd *cmd,
session->reply.hdr.mac,
RSPAMD_CRYPTOBOX_MODE_25519);
}
+ else if (default_disabled) {
+ /* Hash is from a forbidden flag by default, and there is no encryption override */
+ session->reply.rep.ts = 0;
+ session->reply.rep.v1.prob = 0.0f;
+ session->reply.rep.v1.value = 0;
+ session->reply.rep.v1.flag = 0;
+ }
}
rspamd_fuzzy_write_reply (session);