From: Vsevolod Stakhov Date: Mon, 27 Apr 2009 09:42:41 +0000 (+0400) Subject: * Skip identical parts while testing mime regexps X-Git-Tag: 0.2.7~171 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=df6562305f81d4d737a0aedf9f1560375daf8d39;p=rspamd.git * Skip identical parts while testing mime regexps --- diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index 6693d5782..e1f751ef9 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -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;