]> source.dussan.org Git - rspamd.git/commitdiff
* Skip identical parts while testing mime regexps
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 27 Apr 2009 09:42:41 +0000 (13:42 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 27 Apr 2009 09:42:41 +0000 (13:42 +0400)
src/plugins/regexp.c

index 6693d5782cf29d0c52d1be37ab2446ea6d309b26..e1f751ef9d9e1ef76d5b47971be609f787d6ef1a 100644 (file)
@@ -203,7 +203,7 @@ static gsize
 process_regexp (struct rspamd_regexp *re, struct worker_task *task)
 {
        char *headerv, *c, t;
-       struct mime_text_part *part;
+       struct mime_text_part *part, *tmp;
        GList *cur, *headerlist;
        GRegex *regexp;
        struct uri *url;
@@ -271,7 +271,16 @@ process_regexp (struct rspamd_regexp *re, struct worker_task *task)
                                        task_cache_add (task, re, 1);
                                        return 1;
                                }
-                               cur = g_list_next (cur);
+                               /* Skip identical parts */
+                               while (cur) {
+                                       cur = g_list_next (cur);
+                                       if (cur) {
+                                               tmp = (struct mime_text_part *)cur->data;
+                                               if (fuzzy_compare_hashes (tmp->fuzzy, part->fuzzy) > 70) {
+                                                       break;
+                                               }
+                                       }
+                               }
                        }
                        task_cache_add (task, re, 0);
                        return 0;