diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-27 16:10:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-27 16:10:21 +0100 |
commit | 0e7eeb52add2e905fd935043b6a80519f283ef91 (patch) | |
tree | bf675807ad946946d01ac637262a931dc85697aa /src/libmime | |
parent | 797d8332a72ca43b870e077f238d15184206cf66 (diff) | |
download | rspamd-0e7eeb52add2e905fd935043b6a80519f283ef91.tar.gz rspamd-0e7eeb52add2e905fd935043b6a80519f283ef91.zip |
[Fix] Restore support for `for` and `id` parts in received headers
Diffstat (limited to 'src/libmime')
-rw-r--r-- | src/libmime/mime_headers.c | 18 | ||||
-rw-r--r-- | src/libmime/mime_headers.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c index fec23927e..de4184bb9 100644 --- a/src/libmime/mime_headers.c +++ b/src/libmime/mime_headers.c @@ -906,6 +906,7 @@ enum rspamd_received_part_type { RSPAMD_RECEIVED_PART_BY, RSPAMD_RECEIVED_PART_FOR, RSPAMD_RECEIVED_PART_WITH, + RSPAMD_RECEIVED_PART_ID, RSPAMD_RECEIVED_PART_UNKNOWN, }; @@ -1238,6 +1239,12 @@ rspamd_smtp_received_spill (struct rspamd_task *task, cur_part = rspamd_smtp_received_process_part (task, p, end - p, RSPAMD_RECEIVED_PART_FOR, &pos); } + else if (len > sizeof ("id") && (lc_map[p[0]] == 'i' && + lc_map[p[1]] == 'd')) { + p += sizeof ("id") - 1; + cur_part = rspamd_smtp_received_process_part (task, p, end - p, + RSPAMD_RECEIVED_PART_ID, &pos); + } else { while (p < end) { if (!(g_ascii_isspace (*p) || *p == '(' || *p == ';')) { @@ -1615,6 +1622,17 @@ rspamd_smtp_received_parse (struct rspamd_task *task, } break; + case RSPAMD_RECEIVED_PART_FOR: + rh->for_addr = rspamd_email_address_from_smtp (cur->data, cur->dlen); + + if (rh->for_addr) { + rh->for_mbox = rh->for_addr->addr; + + rspamd_mempool_add_destructor (task->task_pool, + (rspamd_mempool_destruct_t)rspamd_email_address_free, + rh->for_addr); + } + break; default: /* Do nothing */ break; diff --git a/src/libmime/mime_headers.h b/src/libmime/mime_headers.h index 18d23d662..56e29e9f9 100644 --- a/src/libmime/mime_headers.h +++ b/src/libmime/mime_headers.h @@ -95,6 +95,8 @@ enum rspamd_received_type { RSPAMD_RECEIVED_MAPI| \ RSPAMD_RECEIVED_UNKNOWN) +struct rspamd_email_address; + struct rspamd_received_header { const gchar *from_hostname; const gchar *from_ip; @@ -102,6 +104,7 @@ struct rspamd_received_header { const gchar *real_ip; const gchar *by_hostname; const gchar *for_mbox; + struct rspamd_email_address *for_addr; rspamd_inet_addr_t *addr; struct rspamd_mime_header *hdr; time_t timestamp; |