aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/message.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-14 12:22:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-14 12:22:27 +0100
commit1453b09a9885edc0a8aa99d728c01bc96db5bb86 (patch)
treee3c25928f7c9263150cd08f323b9856d224bb8d5 /src/libmime/message.c
parent25b777b360662a391454f64346589dbec792831f (diff)
downloadrspamd-1453b09a9885edc0a8aa99d728c01bc96db5bb86.tar.gz
rspamd-1453b09a9885edc0a8aa99d728c01bc96db5bb86.zip
[Feature] Enable workaround for exim
Diffstat (limited to 'src/libmime/message.c')
-rw-r--r--src/libmime/message.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index 791bd6837..5b7c4ae2f 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -1650,6 +1650,32 @@ rspamd_message_parse (struct rspamd_task *task)
len --;
}
+ /*
+ * Exim somehow uses mailbox format for messages being scanned:
+ * From xxx@xxx.com Fri May 13 19:08:48 2016
+ *
+ * So we check if a task has non-http format then we check for such a line
+ * at the beginning to avoid errors
+ */
+ if (!(task->flags & RSPAMD_TASK_FLAG_JSON)) {
+ if (len > sizeof ("From ") - 1) {
+ if (memcmp (p, "From ", sizeof ("From ") - 1) == 0) {
+ /* Skip to CRLF */
+ msg_info_task ("mailbox input detected, enable workaround");
+ p += sizeof ("From ") - 1;
+
+ while (len > 0 && *p != '\n') {
+ p ++;
+ len --;
+ }
+ while (len > 0 && g_ascii_isspace (*p)) {
+ p ++;
+ len --;
+ }
+ }
+ }
+ }
+
tmp->data = (guint8 *)p;
tmp->len = len;