From: Vsevolod Stakhov Date: Thu, 14 Jul 2011 07:17:34 +0000 (+0400) Subject: Fix multiply compare_parts_distance calls. X-Git-Tag: 0.4.0~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e877394d741fd99a2ed2246f802cd5655f061b5;p=thirdparty%2Frspamd.git Fix multiply compare_parts_distance calls. --- diff --git a/src/expressions.c b/src/expressions.c index 2d564aa22a..641cc6dc40 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;