summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-12 10:09:37 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-12 10:09:37 +0000
commitdfc2fe8153d1dc6a4271373059f215029ca4a2e1 (patch)
tree3c2b5ae8de99bce795f6c9ad783f0392d3c7c6f2 /src
parent25a45b7f2bef43394f9df53116dc5d7bda714ec8 (diff)
downloadrspamd-dfc2fe8153d1dc6a4271373059f215029ca4a2e1.tar.gz
rspamd-dfc2fe8153d1dc6a4271373059f215029ca4a2e1.zip
[Fix] Properly set missing fields in exporter
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/metadata_exporter.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua
index 2bd2f833e..36e2a819a 100644
--- a/src/plugins/lua/metadata_exporter.lua
+++ b/src/plugins/lua/metadata_exporter.lua
@@ -60,9 +60,9 @@ Symbols: $symbols]],
local function get_general_metadata(task, flatten, no_content)
local r = {}
- r.ip = tostring(task:get_from_ip())
- r.user = task:get_user()
- r.qid = task:get_queue_id()
+ r.ip = tostring(task:get_from_ip()) or 'unknown'
+ r.user = task:get_user() or 'unknown'
+ r.qid = task:get_queue_id() or 'unknown'
r.action = task:get_metric_action('default')
r.score = task:get_metric_score('default')[1]
local rcpt = task:get_recipients('smtp')
@@ -76,10 +76,14 @@ local function get_general_metadata(task, flatten, no_content)
else
r.rcpt = table.concat(l, ', ')
end
+ else
+ r.rcpt = 'unknown'
end
local from = task:get_from('smtp')
if ((from or E)[1] or E).addr then
r.from = from[1].addr
+ else
+ r.from = 'unknown'
end
local syminf = task:get_symbols_all()
if flatten then
@@ -110,6 +114,8 @@ local function get_general_metadata(task, flatten, no_content)
else
return table.concat(l, '\n')
end
+ else
+ return 'unknown'
end
end
if not no_content then