aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-16 20:04:11 +0000
committerGitHub <noreply@github.com>2020-01-16 20:04:11 +0000
commitdae6f5e3d3d1e6b7eb53475733845b0b8be075e3 (patch)
tree4872e144448be08e256a14714c93591bda525b36 /src
parentf88b044583900b1f694e5d2c01516cd71b2a1008 (diff)
parenta34ac243e88cabe59ed524582812f898ffbac46b (diff)
downloadrspamd-dae6f5e3d3d1e6b7eb53475733845b0b8be075e3.tar.gz
rspamd-dae6f5e3d3d1e6b7eb53475733845b0b8be075e3.zip
Merge pull request #3215 from korgoth1/master
[Feature] SPF: Convert external IP to a map
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/spf.lua14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/plugins/lua/spf.lua b/src/plugins/lua/spf.lua
index 10daa0d2b..d6949cd76 100644
--- a/src/plugins/lua/spf.lua
+++ b/src/plugins/lua/spf.lua
@@ -89,7 +89,7 @@ local function spf_check_callback(task)
local found = false
for i,hdr in ipairs(rh) do
- if hdr.real_ip and hdr.real_ip == local_config.external_relay then
+ if hdr.real_ip and local_config.external_relay:get_key(hdr.real_ip) then
-- We can use the next header as a source of IP address
if rh[i + 1] then
local nhdr = rh[i + 1]
@@ -219,16 +219,10 @@ if local_config.whitelist then
end
if local_config.external_relay then
- local rspamd_ip = require "rspamd_ip"
- local ip = rspamd_ip.from_string(local_config.external_relay)
+ local lua_maps = require "lua_maps"
- if not ip or not ip:is_valid() then
- rspamd_logger.errx(rspamd_config, "invalid external relay IP: %s",
- local_config.external_relay)
- local_config.external_relay = nil
- else
- local_config.external_relay = ip
- end
+ local_config.external_relay = lua_maps.map_add_from_ucl(local_config.external_relay,
+ "radix", "External IP SPF map")
end
for _,sym in pairs(local_config.symbols) do