]> source.dussan.org Git - rspamd.git/commitdiff
Fix multiply compare_parts_distance calls.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 14 Jul 2011 07:17:34 +0000 (11:17 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 14 Jul 2011 07:17:34 +0000 (11:17 +0400)
src/expressions.c

index 2d564aa22a0474a1569eba96b26010cb53dadf6e..641cc6dc403fc477a9b2ca9c9c8e7ceae0250170 100644 (file)
@@ -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;