diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-01-10 19:17:10 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-01-10 19:21:39 +0000 |
commit | 4eb85b3b6ab7d039a71b53f4f1a972ee33d5ed2d (patch) | |
tree | b08ac285cba2cc094090c174b8d8928ea5263333 /src/plugins/lua | |
parent | c05610ca08481b576e0054121171ee2e238e3761 (diff) | |
download | rspamd-4eb85b3b6ab7d039a71b53f4f1a972ee33d5ed2d.tar.gz rspamd-4eb85b3b6ab7d039a71b53f4f1a972ee33d5ed2d.zip |
[Fix] Sanitize IP in history redis
Diffstat (limited to 'src/plugins/lua')
-rw-r--r-- | src/plugins/lua/history_redis.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua index 6e26bc06f..abeadc801 100644 --- a/src/plugins/lua/history_redis.lua +++ b/src/plugins/lua/history_redis.lua @@ -75,7 +75,13 @@ local function normalise_results(tbl, task) tbl.subject = task:get_header('subject') or 'unknown' tbl.size = task:get_size() - tbl.ip = tostring(task:get_from_ip() or 'unknown') + local ip = task:get_from_ip() + if ip and ip:is_valid() then + tbl.ip = tostring(ip) + else + tbl.ip = 'unknown' + end + tbl.user = task:get_user() or 'unknown' end |