diff options
author | Andrew Lewis <nerf@judo.za.org> | 2016-12-15 11:38:26 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2016-12-15 11:38:26 +0200 |
commit | f9de08822c9dac84c30d1e7885d1400aa584a0b1 (patch) | |
tree | f52c1d8bfb99df6833ba8574379125f8fe2ad7e8 /src/plugins/lua/whitelist.lua | |
parent | 82c29e005bb28986ab2efcb45ec17abae0a81ad2 (diff) | |
download | rspamd-f9de08822c9dac84c30d1e7885d1400aa584a0b1.tar.gz rspamd-f9de08822c9dac84c30d1e7885d1400aa584a0b1.zip |
[Minor] Avoid some table lookups in Lua parts
Diffstat (limited to 'src/plugins/lua/whitelist.lua')
-rw-r--r-- | src/plugins/lua/whitelist.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/lua/whitelist.lua b/src/plugins/lua/whitelist.lua index 0272a03d9..710b22eff 100644 --- a/src/plugins/lua/whitelist.lua +++ b/src/plugins/lua/whitelist.lua @@ -26,6 +26,8 @@ local options = { rules = {} } +local E = {} + local function whitelist_cb(symbol, rule, task) local domains = {} @@ -73,7 +75,7 @@ local function whitelist_cb(symbol, rule, task) -- Now we can check from domain or helo local from = task:get_from(1) - if from and from[1] and from[1]['domain'] then + if ((from or E)[1] or E).domain then local tld = rspamd_util.get_tld(from[1]['domain']) if tld then @@ -126,7 +128,7 @@ local function whitelist_cb(symbol, rule, task) end local from = task:get_from(2) - if from and from[1] and from[1]['domain'] then + if ((from or E)[1] or E).domain then local tld = rspamd_util.get_tld(from[1]['domain']) if tld then |