diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-25 16:58:11 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-25 16:58:11 +0400 |
commit | 34ae83f0151a3fd31f4c045968defa39a2c40985 (patch) | |
tree | 3bb121336c76d16e3e5257c12a7905af0e04b70f /src/expressions.c | |
parent | 4a8c30c78940a9153de23dc4d031273649e93cce (diff) | |
download | rspamd-34ae83f0151a3fd31f4c045968defa39a2c40985.tar.gz rspamd-34ae83f0151a3fd31f4c045968defa39a2c40985.zip |
* Add rspamd_log variable to lua plugins to access logging functions
* Each part in rspamd task now can have parent part
* Check for parts distance only for multipart/alternative subparts
* Do not check attachements even if they are text (but attached as file)
* Do not die if write (2) returned ENOSPACE while doing logging, turn on throttling mode instead (1 write try in a second)
* Add ability to turn on debug for specific symbols
* Add ability to configure dns timeouts and dns retransmits in config file
Diffstat (limited to 'src/expressions.c')
-rw-r--r-- | src/expressions.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/expressions.c b/src/expressions.c index 447bdcbc2..c3ece6808 100644 --- a/src/expressions.c +++ b/src/expressions.c @@ -929,6 +929,9 @@ rspamd_parts_distance (struct worker_task * task, GList * args, void *unused) struct mime_text_part *p1, *p2; GList *cur; struct expression_argument *arg; + GMimeObject *parent; + const GMimeContentType *ct; + if (args == NULL) { debug_task ("no threshold is specified, assume it 100"); @@ -953,6 +956,19 @@ rspamd_parts_distance (struct worker_task * task, GList * args, void *unused) return FALSE; } p2 = cur->data; + /* First of all check parent object */ + if (p1->parent && p1->parent == p2->parent) { + parent = p1->parent; + ct = g_mime_object_get_content_type (parent); + if (ct == NULL || ! g_mime_content_type_is_type (ct, "multipart", "alternative")) { + debug_task ("two parts are not belong to multipart/alternative container, skip check"); + return FALSE; + } + } + else { + debug_task ("message contains two parts but they are in different multi-parts"); + return FALSE; + } if (!p1->is_empty && !p2->is_empty) { diff = fuzzy_compare_hashes (p1->fuzzy, p2->fuzzy); debug_task ("got likeliness between parts of %d%%, threshold is %d%%", diff, threshold); |