From 6e877394d741fd99a2ed2246f802cd5655f061b5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 14 Jul 2011 11:17:34 +0400 Subject: [PATCH] Fix multiply compare_parts_distance calls. --- src/expressions.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/expressions.c b/src/expressions.c index 2d564aa22..641cc6dc4 100644 --- a/src/expressions.c +++ b/src/expressions.c @@ -1044,8 +1044,18 @@ rspamd_parts_distance (struct worker_task * task, GList * args, void *unused) if ((pdiff = memory_pool_get_variable (task->task_pool, "parts_distance")) != NULL) { diff = *pdiff; - if (diff != -1 && diff <= threshold) { - return TRUE; + if (diff != -1) { + if (threshold2 > 0) { + if (diff >= MIN (threshold, threshold2) && diff <= MAX (threshold, threshold2)) { + return TRUE; + } + } + else { + if (diff <= threshold) { + return TRUE; + } + } + return FALSE; } else { return FALSE; -- 2.39.5