diff options
author | Andrew Lewis <nerf@judo.za.org> | 2018-01-11 10:53:13 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2018-01-11 10:53:13 +0200 |
commit | 0a41aa90cabb8af584b5b088bd01e4175f7d7fc8 (patch) | |
tree | a24791cde098e4956de007273f9ea5313bb53c0f /src | |
parent | bf80b5054ced69c97e80c3b30123f909de898f6b (diff) | |
download | rspamd-0a41aa90cabb8af584b5b088bd01e4175f7d7fc8.tar.gz rspamd-0a41aa90cabb8af584b5b088bd01e4175f7d7fc8.zip |
[Fix] Metadata exporter: check IP sanity
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/metadata_exporter.lua | 7 |
1 files changed, 6 insertions, 1 deletions
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') |