aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-02 20:42:40 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-02 20:43:28 +0100
commitc9b0a2a75706bf5ef82aa0318419b3655af56513 (patch)
treee1c42496856e9bbb1f3d786e4c3f603603aa970d /src/libmime
parent08667a7acad7021eefda5a84b9c7c7c6eeb796df (diff)
downloadrspamd-c9b0a2a75706bf5ef82aa0318419b3655af56513.tar.gz
rspamd-c9b0a2a75706bf5ef82aa0318419b3655af56513.zip
[Feature] Implement headers flags in mime parser
MFH: rspamd-1.6
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/mime_headers.c24
-rw-r--r--src/libmime/mime_headers.h21
2 files changed, 28 insertions, 17 deletions
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index e187c5d14..742b36fd3 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -53,26 +53,26 @@ rspamd_mime_header_check_special (struct rspamd_task *task,
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;
+ rh->type = RSPAMD_HEADER_TO|RSPAMD_HEADER_RCPT|RSPAMD_HEADER_UNIQUE;
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;
+ rh->type = RSPAMD_HEADER_CC|RSPAMD_HEADER_RCPT|RSPAMD_HEADER_UNIQUE;
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;
+ rh->type = RSPAMD_HEADER_BCC|RSPAMD_HEADER_RCPT|RSPAMD_HEADER_UNIQUE;
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;
+ rh->type = RSPAMD_HEADER_FROM|RSPAMD_HEADER_SENDER|RSPAMD_HEADER_UNIQUE;
break;
case 0x43A558FC7C240226ULL: /* message-id */ {
- rh->type = RSPAMD_HEADER_MESSAGE_ID;
+ rh->type = RSPAMD_HEADER_MESSAGE_ID|RSPAMD_HEADER_UNIQUE;
p = rh->decoded;
end = p + strlen (p);
@@ -111,20 +111,28 @@ rspamd_mime_header_check_special (struct rspamd_task *task,
if (task->subject == NULL) {
task->subject = rh->decoded;
}
- rh->type = RSPAMD_HEADER_SUBJECT;
+ rh->type = RSPAMD_HEADER_SUBJECT|RSPAMD_HEADER_UNIQUE;
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;
+ rh->type = RSPAMD_HEADER_RETURN_PATH|RSPAMD_HEADER_UNIQUE;
break;
case 0xB9EEFAD2E93C2161ULL: /* delivered-to */
if (task->deliver_to == NULL) {
task->deliver_to = rh->decoded;
}
- rh->type = RSPAMD_HEADER_DELIVERED_TO;
+ rh->type = RSPAMD_HEADER_DELIVERED_TO|RSPAMD_HEADER_UNIQUE;
+ break;
+ case 0x2EC3BFF3C393FC10ULL: /* date */
+ case 0xAC0DDB1A1D214CAULL: /* sender */
+ case 0x54094572367AB695ULL: /* in-reply-to */
+ case 0x81CD9E9131AB6A9AULL: /* content-type */
+ case 0xC39BD9A75AA25B60ULL: /* content-transfer-encoding */
+ case 0xB3F6704CB3AD6589ULL: /* references */
+ rh->type = RSPAMD_HEADER_UNIQUE;
break;
}
}
diff --git a/src/libmime/mime_headers.h b/src/libmime/mime_headers.h
index 14ece02e6..03a7beae9 100644
--- a/src/libmime/mime_headers.h
+++ b/src/libmime/mime_headers.h
@@ -28,15 +28,18 @@ enum rspamd_rfc2047_encoding {
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,
+ RSPAMD_HEADER_RECEIVED = 1 << 0,
+ RSPAMD_HEADER_TO = 1 << 2,
+ RSPAMD_HEADER_CC = 1 << 3,
+ RSPAMD_HEADER_BCC = 1 << 4,
+ RSPAMD_HEADER_FROM = 1 << 5,
+ RSPAMD_HEADER_MESSAGE_ID = 1 << 6,
+ RSPAMD_HEADER_SUBJECT = 1 << 7,
+ RSPAMD_HEADER_RETURN_PATH = 1 << 8,
+ RSPAMD_HEADER_DELIVERED_TO = 1 << 9,
+ RSPAMD_HEADER_SENDER = 1 << 10,
+ RSPAMD_HEADER_RCPT = 1 << 11,
+ RSPAMD_HEADER_UNIQUE = 1 << 12
};
struct rspamd_mime_header {