From: Andrew Lewis Date: Thu, 11 Jan 2018 08:53:13 +0000 (+0200) Subject: [Fix] Metadata exporter: check IP sanity X-Git-Tag: 1.7.0~293 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0a41aa90cabb8af584b5b088bd01e4175f7d7fc8;p=rspamd.git [Fix] Metadata exporter: check IP sanity --- diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua index 7d2d53148..d2d12cad5 100644 --- a/src/plugins/lua/metadata_exporter.lua +++ b/src/plugins/lua/metadata_exporter.lua @@ -66,7 +66,12 @@ Symbols: $symbols]], local function get_general_metadata(task, flatten, no_content) local r = {} - r.ip = tostring(task:get_from_ip()) or 'unknown' + local ip = task:get_from_ip() + if ip and ip:is_valid() then + r.ip = tostring(ip) + else + r.ip = 'unknown' + end r.user = task:get_user() or 'unknown' r.qid = task:get_queue_id() or 'unknown' r.action = task:get_metric_action('default')