aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_expressions.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-27 16:05:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-27 16:05:15 +0100
commit1ed9f282a568ef64372f687dba5ca25033b0ce2b (patch)
treeaf29263bf46da3c936cb1c9c0aa4743f9e736438 /src/libmime/mime_expressions.c
parent781af3209968da2b8d7a4b1e38d4a1473c8a9852 (diff)
downloadrspamd-1ed9f282a568ef64372f687dba5ca25033b0ce2b.tar.gz
rspamd-1ed9f282a568ef64372f687dba5ca25033b0ce2b.zip
[Fix] Fix and rescore R_PARTS_DIFFER logic
Signed-off-by: Vsevolod Stakhov <vsevolod@highsecure.ru>
Diffstat (limited to 'src/libmime/mime_expressions.c')
-rw-r--r--src/libmime/mime_expressions.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index fcea95bb2..c73b1c17c 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -956,9 +956,9 @@ rspamd_header_exists (struct rspamd_task * task, GArray * args, void *unused)
gboolean
rspamd_parts_distance (struct rspamd_task * task, GArray * args, void *unused)
{
- gint threshold, threshold2 = -1, diff;
+ gint threshold, threshold2 = -1;
struct expression_argument *arg;
- gint *pdiff;
+ gdouble *pdiff, diff;
if (args == NULL || args->len == 0) {
debug_task ("no threshold is specified, assume it 100");
@@ -998,12 +998,13 @@ rspamd_parts_distance (struct rspamd_task * task, GArray * args, void *unused)
if ((pdiff =
rspamd_mempool_get_variable (task->task_pool,
"parts_distance")) != NULL) {
- diff = *pdiff;
+ diff = (1.0 - (*pdiff)) * 100.0;
+
if (diff != -1) {
if (threshold2 > 0) {
- if (diff >=
- MIN (threshold,
- threshold2) && diff < MAX (threshold, threshold2)) {
+ if (diff >= MIN (threshold, threshold2) &&
+ diff < MAX (threshold, threshold2)) {
+
return TRUE;
}
}