summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-13 14:37:45 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-13 14:37:45 +0100
commite1ca9e917869509084743c28f2500e7fd5ff6f1e (patch)
tree68c0b4bd1e8595d56bad4e2c6b3e55fc53795596
parent1d128aec74a30a714c8677bae78042d1a15941eb (diff)
downloadrspamd-e1ca9e917869509084743c28f2500e7fd5ff6f1e.tar.gz
rspamd-e1ca9e917869509084743c28f2500e7fd5ff6f1e.zip
[Minor] Set explicit type for known headers
-rw-r--r--src/libmime/mime_headers.c11
-rw-r--r--src/libmime/mime_headers.h14
2 files changed, 24 insertions, 1 deletions
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index ef05bfcb3..bb9284f6a 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -48,25 +48,31 @@ rspamd_mime_header_check_special (struct rspamd_task *task,
}
g_ptr_array_add (task->received, recv);
+ rh->type = RSPAMD_HEADER_RECEIVED;
break;
case 0x76F31A09F4352521ULL: /* to */
task->rcpt_mime = rspamd_email_address_from_mime (task->task_pool,
rh->value, strlen (rh->value), task->rcpt_mime);
+ rh->type = RSPAMD_HEADER_TO;
break;
case 0x7EB117C1480B76ULL: /* cc */
task->rcpt_mime = rspamd_email_address_from_mime (task->task_pool,
rh->value, strlen (rh->value), task->rcpt_mime);
+ rh->type = RSPAMD_HEADER_CC;
break;
case 0xE4923E11C4989C8DULL: /* bcc */
task->rcpt_mime = rspamd_email_address_from_mime (task->task_pool,
rh->value, strlen (rh->value), task->rcpt_mime);
+ rh->type = RSPAMD_HEADER_BCC;
break;
case 0x41E1985EDC1CBDE4ULL: /* from */
task->from_mime = rspamd_email_address_from_mime (task->task_pool,
rh->value, strlen (rh->value), task->from_mime);
+ rh->type = RSPAMD_HEADER_FROM;
break;
case 0x43A558FC7C240226ULL: /* message-id */ {
+ rh->type = RSPAMD_HEADER_MESSAGE_ID;
p = rh->decoded;
end = p + strlen (p);
@@ -105,17 +111,20 @@ rspamd_mime_header_check_special (struct rspamd_task *task,
if (task->subject == NULL) {
task->subject = rh->decoded;
}
+ rh->type = RSPAMD_HEADER_SUBJECT;
break;
case 0xEE4AA2EAAC61D6F4ULL: /* return-path */
if (task->from_envelope == NULL) {
task->from_envelope = rspamd_email_address_from_smtp (rh->decoded,
strlen (rh->decoded));
}
+ rh->type = RSPAMD_HEADER_RETURN_PATH;
break;
case 0xB9EEFAD2E93C2161ULL: /* delivered-to */
if (task->deliver_to == NULL) {
task->deliver_to = rh->decoded;
}
+ rh->type = RSPAMD_HEADER_DELIVERED_TO;
break;
}
}
@@ -433,7 +442,7 @@ rspamd_mime_headers_process (struct rspamd_task *task, GHashTable *target,
while (cur) {
nh = cur->data;
- if (nh->name) {
+ if (nh->name && nh->type != RSPAMD_HEADER_RECEIVED) {
rspamd_cryptobox_hash_update (&hs, nh->name, strlen (nh->name));
}
diff --git a/src/libmime/mime_headers.h b/src/libmime/mime_headers.h
index 299e84dea..14ece02e6 100644
--- a/src/libmime/mime_headers.h
+++ b/src/libmime/mime_headers.h
@@ -26,6 +26,19 @@ enum rspamd_rfc2047_encoding {
RSPAMD_RFC2047_BASE64,
};
+enum rspamd_mime_header_special_type {
+ RSPAMD_HEADER_GENERIC = 0,
+ RSPAMD_HEADER_RECEIVED = 1,
+ RSPAMD_HEADER_TO,
+ RSPAMD_HEADER_CC,
+ RSPAMD_HEADER_BCC,
+ RSPAMD_HEADER_FROM,
+ RSPAMD_HEADER_MESSAGE_ID,
+ RSPAMD_HEADER_SUBJECT,
+ RSPAMD_HEADER_RETURN_PATH,
+ RSPAMD_HEADER_DELIVERED_TO,
+};
+
struct rspamd_mime_header {
gchar *name;
gchar *value;
@@ -34,6 +47,7 @@ struct rspamd_mime_header {
gboolean tab_separated;
gboolean empty_separator;
guint order;
+ enum rspamd_mime_header_special_type type;
gchar *separator;
gchar *decoded;
};