summaryrefslogtreecommitdiffstats
path: root/lualib/lua_ffi/spf.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-12 16:32:22 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-04-12 16:32:22 +0100
commit59218b4e0740d61be2634ab681d2990c174c2d49 (patch)
tree91286f4bd5e90474a3289ce100d1a4e3238c5639 /lualib/lua_ffi/spf.lua
parent4824ea2d2b8fecd5f19059e775914d8d64d1dbc9 (diff)
downloadrspamd-59218b4e0740d61be2634ab681d2990c174c2d49.tar.gz
rspamd-59218b4e0740d61be2634ab681d2990c174c2d49.zip
[Feature] Rspamadm: Add dns_tool utility
Diffstat (limited to 'lualib/lua_ffi/spf.lua')
-rw-r--r--lualib/lua_ffi/spf.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/lualib/lua_ffi/spf.lua b/lualib/lua_ffi/spf.lua
index e65405160..c75eee0d2 100644
--- a/lualib/lua_ffi/spf.lua
+++ b/lualib/lua_ffi/spf.lua
@@ -82,6 +82,8 @@ local function convert_mech(mech)
end
end
+local NULL = ffi.new 'void*'
+
local function spf_addr_tolua(ffi_spf_addr)
local ipstr = ffi.C.spf_addr_mask_to_string(ffi_spf_addr)
local ret = {
@@ -89,7 +91,7 @@ local function spf_addr_tolua(ffi_spf_addr)
ipnet = ffi.string(ipstr),
}
- if ffi_spf_addr.spf_string then
+ if ffi_spf_addr.spf_string ~= NULL then
ret.spf_str = ffi.string(ffi_spf_addr.spf_string)
end
@@ -116,7 +118,7 @@ local function spf_resolve(task, cb)
local matched = ffi.C.spf_addr_match_task(task:topointer(), rec)
- if matched then
+ if matched ~= NULL then
cb(true, res, spf_addr_tolua(matched))
else
cb(true, res, nil)