From 0e654a69f908ae3abe19663dc192f1dbc45d8ed0 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 11 Jun 2018 11:32:43 +0100 Subject: [Feature] Improve error reporting for DKIM key access issues --- rules/rspamd.lua | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'rules/rspamd.lua') diff --git a/rules/rspamd.lua b/rules/rspamd.lua index 6b53828ee..a193eb495 100644 --- a/rules/rspamd.lua +++ b/rules/rspamd.lua @@ -23,6 +23,7 @@ rspamd_maps = {} -- Global maps local local_conf = rspamd_paths['CONFDIR'] local local_rules = rspamd_paths['RULESDIR'] +local rspamd_util = require "rspamd_util" dofile(local_rules .. '/regexp/headers.lua') dofile(local_rules .. '/regexp/misc.lua') @@ -36,26 +37,16 @@ dofile(local_rules .. '/http_headers.lua') dofile(local_rules .. '/forwarding.lua') dofile(local_rules .. '/mid.lua') -local function file_exists(filename) - local file = io.open(filename) - if file then - io.close(file) - return true - else - return false - end -end - -if file_exists(local_conf .. '/rspamd.local.lua') then +if rspamd_util.file_exists(local_conf .. '/rspamd.local.lua') then dofile(local_conf .. '/rspamd.local.lua') else -- Legacy lua/rspamd.local.lua - if file_exists(local_conf .. '/lua/rspamd.local.lua') then + if rspamd_util.file_exists(local_conf .. '/lua/rspamd.local.lua') then dofile(local_conf .. '/lua/rspamd.local.lua') end end -if file_exists(local_rules .. '/rspamd.classifiers.lua') then +if rspamd_util.file_exists(local_rules .. '/rspamd.classifiers.lua') then dofile(local_rules .. '/rspamd.classifiers.lua') end -- cgit v1.2.3