aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_parser.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-21 12:35:58 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-21 12:35:58 +0000
commit3c772979bbcfee948054e853aa8325b8e43ac944 (patch)
tree8a25b12e7fa3f5d1389b004cd4a131ca717dd26c /src/libmime/mime_parser.c
parentcb5fa030df56eb424d832b99009816989072124c (diff)
downloadrspamd-3c772979bbcfee948054e853aa8325b8e43ac944.tar.gz
rspamd-3c772979bbcfee948054e853aa8325b8e43ac944.zip
[Rework] Change mime part specifics handling
Diffstat (limited to 'src/libmime/mime_parser.c')
-rw-r--r--src/libmime/mime_parser.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
index 5d4ab9f7c..7b38b80b1 100644
--- a/src/libmime/mime_parser.c
+++ b/src/libmime/mime_parser.c
@@ -508,7 +508,7 @@ rspamd_mime_parse_normal_part (struct rspamd_task *task,
}
}
- if (IS_CT_TEXT (part->ct)) {
+ if (part->ct && (part->ct->flags & RSPAMD_CONTENT_TYPE_TEXT)) {
/* Need to copy text as we have couple of in-place change functions */
parsed = rspamd_fstring_sized_new (part->raw_data.len);
parsed->len = part->raw_data.len;
@@ -720,6 +720,7 @@ rspamd_mime_process_multipart_node (struct rspamd_task *task,
if (sel->flags & RSPAMD_CONTENT_TYPE_MULTIPART) {
st->nesting ++;
g_ptr_array_add (st->stack, npart);
+ npart->part_type = RSPAMD_MIME_PART_MULTIPART;
npart->specific.mp = rspamd_mempool_alloc0 (task->task_pool,
sizeof (struct rspamd_mime_multipart));
memcpy (&npart->specific.mp->boundary, &sel->orig_boundary,
@@ -729,6 +730,7 @@ rspamd_mime_process_multipart_node (struct rspamd_task *task,
else if (sel->flags & RSPAMD_CONTENT_TYPE_MESSAGE) {
st->nesting ++;
g_ptr_array_add (st->stack, npart);
+ npart->part_type = RSPAMD_MIME_PART_MESSAGE;
if ((ret = rspamd_mime_parse_normal_part (task, npart, st, err))
== RSPAMD_MIME_PARSE_OK) {
@@ -1366,6 +1368,7 @@ rspamd_mime_parse_message (struct rspamd_task *task,
if (sel->flags & RSPAMD_CONTENT_TYPE_MULTIPART) {
g_ptr_array_add (nst->stack, npart);
nst->nesting ++;
+ npart->part_type = RSPAMD_MIME_PART_MULTIPART;
npart->specific.mp = rspamd_mempool_alloc0 (task->task_pool,
sizeof (struct rspamd_mime_multipart));
memcpy (&npart->specific.mp->boundary, &sel->orig_boundary,
@@ -1375,6 +1378,7 @@ rspamd_mime_parse_message (struct rspamd_task *task,
else if (sel->flags & RSPAMD_CONTENT_TYPE_MESSAGE) {
if ((ret = rspamd_mime_parse_normal_part (task, npart, nst, err))
== RSPAMD_MIME_PARSE_OK) {
+ npart->part_type = RSPAMD_MIME_PART_MESSAGE;
ret = rspamd_mime_parse_message (task, npart, nst, err);
}
}