diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-11 18:42:13 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-11 18:42:13 +0400 |
commit | b14402cd4ed5bf9b3efc0cc9d50c812b66a31f57 (patch) | |
tree | 7db7c93232fe4422e4ab76f0b8457644428d373f /src/filter.c | |
parent | 9e6acadd7ce323f42ebed02237d064305df32249 (diff) | |
download | rspamd-b14402cd4ed5bf9b3efc0cc9d50c812b66a31f57.tar.gz rspamd-b14402cd4ed5bf9b3efc0cc9d50c812b66a31f57.zip |
Fix phishing detection with img flag.
Handle unclosed HTML tags properly.
Remove warnings for types on 32 bit archs.
Do not touch grow factor many times when one shot mode is turned on.
Diffstat (limited to 'src/filter.c')
-rw-r--r-- | src/filter.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/filter.c b/src/filter.c index b48bf64ba..fea91125f 100644 --- a/src/filter.c +++ b/src/filter.c @@ -80,18 +80,9 @@ insert_metric_result (struct worker_task *task, struct metric *metric, const gch else { w = (*weight) * flag; } - /* Handle grow factor */ - if (metric_res->grow_factor && w > 0) { - w *= metric_res->grow_factor; - metric_res->grow_factor *= metric->grow_factor; - } - else if (w > 0) { - metric_res->grow_factor = metric->grow_factor; - } - - /* Add metric score */ + /* Add metric score */ if ((s = g_hash_table_lookup (metric_res->symbols, symbol)) != NULL) { if (s->options && opts && opts != s->options) { /* Append new options */ @@ -106,6 +97,14 @@ insert_metric_result (struct worker_task *task, struct metric *metric, const gch memory_pool_add_destructor (task->task_pool, (pool_destruct_func) g_list_free, s->options); } if (!single) { + /* Handle grow factor */ + if (metric_res->grow_factor && w > 0) { + w *= metric_res->grow_factor; + metric_res->grow_factor *= metric->grow_factor; + } + else if (w > 0) { + metric_res->grow_factor = metric->grow_factor; + } s->score += w; metric_res->score += w; } @@ -114,6 +113,14 @@ insert_metric_result (struct worker_task *task, struct metric *metric, const gch s = memory_pool_alloc (task->task_pool, sizeof (struct symbol)); s->score = w; + /* Handle grow factor */ + if (metric_res->grow_factor && w > 0) { + w *= metric_res->grow_factor; + metric_res->grow_factor *= metric->grow_factor; + } + else if (w > 0) { + metric_res->grow_factor = metric->grow_factor; + } s->name = symbol; metric_res->score += w; |