diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-18 18:21:15 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-18 18:21:15 +0000 |
commit | 01727d5d8b5432c3de595bb1af961cdd3559ebcd (patch) | |
tree | ed45e966eefb6952677e571ea23e48a5111983f2 | |
parent | cdce0ad1eef3b5addb466828742a016d3f8ddef7 (diff) | |
download | rspamd-01727d5d8b5432c3de595bb1af961cdd3559ebcd.tar.gz rspamd-01727d5d8b5432c3de595bb1af961cdd3559ebcd.zip |
[Fix] Fix processing of parts with no valid content type
-rw-r--r-- | src/libmime/mime_parser.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c index 6dec581bf..b690f3aa5 100644 --- a/src/libmime/mime_parser.c +++ b/src/libmime/mime_parser.c @@ -437,10 +437,9 @@ rspamd_mime_process_multipart_node (struct rspamd_task *task, } if (sel == NULL) { - /* TODO: assume part as octet-stream */ - g_set_error (err, RSPAMD_MIME_QUARK, EINVAL, "no content type"); - g_assert (0); - return FALSE; + sel = rspamd_mempool_alloc0 (task->task_pool, sizeof (*sel)); + RSPAMD_FTOK_ASSIGN (&sel->type, "application"); + RSPAMD_FTOK_ASSIGN (&sel->subtype, "octet-stream"); } npart->ct = sel; @@ -777,7 +776,7 @@ rspamd_mime_parse_message (struct rspamd_task *task, /* * Exim somehow uses mailbox format for messages being scanned: - * From xxx@xxx.com Fri May 13 19:08:48 2016 + * From x@x.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 @@ -886,11 +885,10 @@ rspamd_mime_parse_message (struct rspamd_task *task, } if (sel == NULL) { - g_set_error (err, RSPAMD_MIME_QUARK, EINVAL, - "Content type header cannot be parsed"); - - /* TODO: assume it raw */ - return FALSE; + /* For messages we automatically assume plaintext */ + sel = rspamd_mempool_alloc0 (task->task_pool, sizeof (*sel)); + RSPAMD_FTOK_ASSIGN (&sel->type, "text"); + RSPAMD_FTOK_ASSIGN (&sel->subtype, "plain"); } npart->ct = sel; |