summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/spamassassin.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-12-15 11:38:26 +0200
committerAndrew Lewis <nerf@judo.za.org>2016-12-15 11:38:26 +0200
commitf9de08822c9dac84c30d1e7885d1400aa584a0b1 (patch)
treef52c1d8bfb99df6833ba8574379125f8fe2ad7e8 /src/plugins/lua/spamassassin.lua
parent82c29e005bb28986ab2efcb45ec17abae0a81ad2 (diff)
downloadrspamd-f9de08822c9dac84c30d1e7885d1400aa584a0b1.tar.gz
rspamd-f9de08822c9dac84c30d1e7885d1400aa584a0b1.zip
[Minor] Avoid some table lookups in Lua parts
Diffstat (limited to 'src/plugins/lua/spamassassin.lua')
-rw-r--r--src/plugins/lua/spamassassin.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index fc23707d9..a02ce8306 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -17,7 +17,9 @@ limitations under the License.
-- This plugin is intended to read and parse spamassassin rules with regexp
-- rules. SA plugins or statistics are not supported
+local E = {}
local N = 'spamassassin'
+
local rspamd_logger = require "rspamd_logger"
local rspamd_regexp = require "rspamd_regexp"
local rspamd_expression = require "rspamd_expression"
@@ -455,7 +457,7 @@ local function gen_eval_rule(arg)
'check_from_in_blacklist',
function(task)
local from = task:get_from('mime')
- if from and from[1] and from[1]['addr'] then
+ if ((from or E)[1] or E).addr then
if sa_lists['from_blacklist'][string.lower(from[1]['addr'])] then
return 1
end
@@ -468,7 +470,7 @@ local function gen_eval_rule(arg)
'check_from_in_whitelist',
function(task)
local from = task:get_from('mime')
- if from and from[1] and from[1]['addr'] then
+ if ((from or E)[1] or E).addr then
if sa_lists['from_whitelist'][string.lower(from[1]['addr'])] then
return 1
end
@@ -481,7 +483,7 @@ local function gen_eval_rule(arg)
'check_from_in_default_whitelist',
function(task)
local from = task:get_from('mime')
- if from and from[1] and from[1]['addr'] then
+ if ((from or E)[1] or E).addr then
if sa_lists['from_def_whitelist'][string.lower(from[1]['addr'])] then
return 1
end