]> git.ipfire.org Git - thirdparty/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>
Wed, 24 Jan 2018 12:11:58 +0000 (14:11 +0200)
src/plugins/lua/metadata_exporter.lua

index 9c883a22bbec0012e61ad4bb4b62340c14be631f..e22b4fd5be28528a02dddd71af10bae908dbbe14 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')