aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/protocol.c8
-rw-r--r--src/libserver/re_cache.c10
-rw-r--r--src/libserver/task.c7
3 files changed, 16 insertions, 9 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index a1a1ae8fe..cdc7f263a 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -778,7 +778,7 @@ make_rewritten_subject (struct rspamd_metric *metric, struct rspamd_task *task)
c = SPAM_SUBJECT;
}
- s = g_mime_message_get_subject (task->message);
+ s = task->subject;
while (p < end) {
if (*c == '\0') {
@@ -794,6 +794,7 @@ make_rewritten_subject (struct rspamd_metric *metric, struct rspamd_task *task)
}
p++;
}
+
res = g_mime_utils_header_encode_text (subj_buf);
rspamd_mempool_add_destructor (task->task_pool,
@@ -897,8 +898,11 @@ rspamd_metric_result_ucl (struct rspamd_task *task,
if (action == METRIC_ACTION_REWRITE_SUBJECT) {
subject = make_rewritten_subject (m, task);
- ucl_object_insert_key (obj, ucl_object_fromstring (subject),
+
+ if (subject) {
+ ucl_object_insert_key (obj, ucl_object_fromstring (subject),
"subject", 0, false);
+ }
}
/* Now handle symbols */
g_hash_table_iter_init (&hiter, mres->symbols);
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index 1e713dc86..e5298ff04 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -884,8 +884,8 @@ rspamd_re_cache_exec_re (struct rspamd_task *task,
}
/* Select data for regexp */
if (re_class->type == RSPAMD_RE_RAWMIME) {
- in = part->raw->data;
- len = part->raw->len;
+ in = part->raw.begin;
+ len = part->raw.len;
raw = TRUE;
}
else {
@@ -1022,9 +1022,9 @@ rspamd_re_cache_exec_re (struct rspamd_task *task,
for (i = 0; i < task->text_parts->len; i++) {
part = g_ptr_array_index (task->text_parts, i);
- if (part->orig) {
- scvec[i] = (guchar *)part->orig->data;
- lenvec[i] = part->orig->len;
+ if (part->parsed.len > 0) {
+ scvec[i] = (guchar *)part->parsed.begin;
+ lenvec[i] = part->parsed.len;
}
else {
scvec[i] = (guchar *)"";
diff --git a/src/libserver/task.c b/src/libserver/task.c
index cee604acd..656e177aa 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -203,8 +203,11 @@ rspamd_task_free (struct rspamd_task *task)
if (p->raw_headers) {
g_hash_table_unref (p->raw_headers);
}
- if (p->children) {
- g_ptr_array_free (p->children, TRUE);
+
+ if (IS_CT_MULTIPART (p->ct)) {
+ if (p->specific.mp.children) {
+ g_ptr_array_free (p->specific.mp.children, TRUE);
+ }
}
}