From: Vsevolod Stakhov Date: Sun, 12 Mar 2017 10:09:37 +0000 (+0000) Subject: [Fix] Properly set missing fields in exporter X-Git-Tag: 1.5.3~47 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dfc2fe8153d1dc6a4271373059f215029ca4a2e1;p=rspamd.git [Fix] Properly set missing fields in exporter --- 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