diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-19 15:00:48 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-19 15:00:48 +0100 |
commit | 7d2447448cbcf025f5152a7091e648b00416a92a (patch) | |
tree | 6c045eeb18c2bc80113a21472c4919f2b26090a6 /src/libserver/protocol.c | |
parent | 994f9676d2c016bb07ec53a0018aaa888ebe2d27 (diff) | |
download | rspamd-7d2447448cbcf025f5152a7091e648b00416a92a.tar.gz rspamd-7d2447448cbcf025f5152a7091e648b00416a92a.zip |
[Feature] Support recipients separated by commas
Diffstat (limited to 'src/libserver/protocol.c')
-rw-r--r-- | src/libserver/protocol.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index c7e693e31..7f12e3883 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -316,19 +316,39 @@ rspamd_protocol_handle_headers (struct rspamd_task *task, case 'r': case 'R': IF_HEADER (RCPT_HEADER) { - addr = rspamd_email_address_from_smtp (hv->str, hv->len); + const gchar *p, *end; + gsize cur_len; - if (addr) { - if (task->rcpt_envelope == NULL) { - task->rcpt_envelope = g_ptr_array_sized_new (2); + p = hv->str; + end = p + hv->len; + + while (p < end) { + cur_len = rspamd_memcspn (p, ",", end - p); + + if (cur_len > 0) { + addr = rspamd_email_address_from_smtp (p, cur_len); + + if (addr) { + if (task->rcpt_envelope == NULL) { + task->rcpt_envelope = g_ptr_array_sized_new ( + 2); + } + + g_ptr_array_add (task->rcpt_envelope, addr); + } else { + msg_err_protocol ("bad rcpt header: '%T'", + &h->value); + task->flags |= RSPAMD_TASK_FLAG_BROKEN_HEADERS; + } + + p += cur_len; } - g_ptr_array_add (task->rcpt_envelope, addr); - } - else { - msg_err_protocol ("bad rcpt header: '%T'", &h->value); - task->flags |= RSPAMD_TASK_FLAG_BROKEN_HEADERS; + while (p < end && *p == ',') { + p ++; + } } + msg_debug_protocol ("read rcpt header, value: %V", hv); } else { |