commit 038039f: [Rework] Continue aliases changes
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Apr 3 10:49:05 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-04-02 19:38:32 +0100
URL: https://github.com/rspamd/rspamd/commit/038039fc3599792d01863eae66d6ebc7f12cc7dc
[Rework] Continue aliases changes
---
src/libserver/task.c | 23 ++++++++++++++++++++---
src/plugins/lua/clickhouse.lua | 2 +-
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/libserver/task.c b/src/libserver/task.c
index dcad1a1ab..d0ef40621 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -1231,22 +1231,39 @@ rspamd_task_write_ialist (struct rspamd_task *task,
rspamd_fstring_t *res = logbuf, *varbuf;
rspamd_ftok_t var = {.begin = NULL, .len = 0};
struct rspamd_email_address *addr;
- gint i, nchars = 0, cur_chars;
+ gint i, nchars = 0, wr = 0, cur_chars;
+ gboolean has_orig = FALSE;
if (addrs && lim <= 0) {
lim = addrs->len;
}
+ PTR_ARRAY_FOREACH (addrs, i, addr) {
+ if (addr->flags & RSPAMD_EMAIL_ADDR_ORIGINAL) {
+ has_orig = TRUE;
+ break;
+ }
+ }
+
varbuf = rspamd_fstring_new ();
PTR_ARRAY_FOREACH (addrs, i, addr) {
- if (i >= lim) {
+ if (wr >= lim) {
break;
}
+
+ if (has_orig) {
+ /* Report merely original addresses */
+ if (!(addr->flags & RSPAMD_EMAIL_ADDR_ORIGINAL)) {
+ continue;
+ }
+ }
+
cur_chars = addr->addr_len;
varbuf = rspamd_fstring_append (varbuf, addr->addr,
cur_chars);
nchars += cur_chars;
+ wr ++;
if (varbuf->len > 0) {
if (i != lim - 1) {
@@ -1254,7 +1271,7 @@ rspamd_task_write_ialist (struct rspamd_task *task,
}
}
- if (i >= max_log_elts || nchars >= max_log_elts * 10) {
+ if (wr >= max_log_elts || nchars >= max_log_elts * 10) {
varbuf = rspamd_fstring_append (varbuf, "...", 3);
break;
}
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index 924b629c8..8e07362f8 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -340,7 +340,7 @@ local function clickhouse_collect(task)
local mime_domain = ''
local mime_user = ''
if task:has_from('mime') then
- local from = task:get_from('mime')[1]
+ local from = task:get_from({'mime','orig'})[1]
if from then
mime_domain = from['domain']
mime_user = from['user']
More information about the Commits
mailing list