From: Vsevolod Stakhov Date: Wed, 10 Jan 2018 19:17:10 +0000 (+0000) Subject: [Fix] Sanitize IP in history redis X-Git-Tag: 1.6.6~3^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ac7464b6a6eb52761043987c15a3e21bec510911;p=rspamd.git [Fix] Sanitize IP in history redis --- diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua index ad65184b9..8489c26f0 100644 --- a/src/plugins/lua/history_redis.lua +++ b/src/plugins/lua/history_redis.lua @@ -73,7 +73,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