diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-06-23 19:05:58 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-06-23 19:05:58 +0400 |
commit | 5022c0333ffd8ce5eca3dc9e2679b612e2c9ce99 (patch) | |
tree | 4b7fd05c9f01700ea372fb941b87312fceece513 /src/plugins | |
parent | de94e18f57a0dccbab76efb3d574c0485a9e3700 (diff) | |
download | rspamd-5022c0333ffd8ce5eca3dc9e2679b612e2c9ce99.tar.gz rspamd-5022c0333ffd8ce5eca3dc9e2679b612e2c9ce99.zip |
* Fixes to fuzzy hashing logic, skip urls while estimating fuzzy hash
Fix tags stripping.
Fix phishing checks (ignore img tags).
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/fuzzy_check.c | 11 | ||||
-rw-r--r-- | src/plugins/regexp.c | 35 |
2 files changed, 21 insertions, 25 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 3f068ed99..93ba4bf25 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -686,6 +686,7 @@ fuzzy_symbol_callback (struct worker_task *task, void *unused) } register_fuzzy_call (task, part->fuzzy); + register_fuzzy_call (task, part->double_fuzzy); cur = g_list_next (cur); } @@ -843,6 +844,16 @@ fuzzy_process_handler (struct controller_session *session, f_str_t * in) free_task (task, FALSE); return; } + if (! register_fuzzy_controller_call (session, task, part->double_fuzzy, cmd, value, flag, saved)) { + /* Cannot write hash */ + session->state = STATE_REPLY; + r = rspamd_snprintf (out_buf, sizeof (out_buf), "cannot write fuzzy hash" CRLF "END" CRLF); + if (! rspamd_dispatcher_write (session->dispatcher, out_buf, r, FALSE, FALSE)) { + return; + } + free_task (task, FALSE); + return; + } cur = g_list_next (cur); } /* Process images */ diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index 441a17de5..a82c60110 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -845,31 +845,16 @@ process_regexp (struct rspamd_regexp *re, struct worker_task *task, const gchar /*XXX: add support of it */ msg_warn ("numbered matches are not supported for url regexp"); } - cur = g_list_first (task->text_parts); - while (cur) { - part = (struct mime_text_part *)cur->data; - /* Skip empty parts */ - if (part->is_empty) { - cur = g_list_next (cur); - continue; - } - if (part->is_raw) { - regexp = re->raw_regexp; - } - else { - regexp = re->regexp; - } - callback_param.task = task; - callback_param.regexp = regexp; - callback_param.re = re; - callback_param.found = FALSE; - if (part->urls) { - g_tree_foreach (part->urls, tree_url_callback, &callback_param); - } - if (part->html_urls && callback_param.found == FALSE) { - g_tree_foreach (part->html_urls, tree_url_callback, &callback_param); - } - cur = g_list_next (cur); + regexp = re->regexp; + callback_param.task = task; + callback_param.regexp = regexp; + callback_param.re = re; + callback_param.found = FALSE; + if (task->urls) { + g_tree_foreach (task->urls, tree_url_callback, &callback_param); + } + if (task->emails && callback_param.found == FALSE) { + g_tree_foreach (task->emails, tree_url_callback, &callback_param); } if (callback_param.found == FALSE) { task_cache_add (task, re, 0); |