]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Metadata exporter: check IP sanity
authorAndrew Lewis <nerf@judo.za.org>
Thu, 11 Jan 2018 08:53:13 +0000 (10:53 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Thu, 11 Jan 2018 08:53:13 +0000 (10:53 +0200)
src/plugins/lua/metadata_exporter.lua

index 7d2d531484c1ba6b4fcaa86023847282813ae9c6..d2d12cad5d00c2774f53d3c1728e721e4213da2c 100644 (file)
@@ -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')