diff options
Diffstat (limited to 'lualib/lua_ffi/spf.lua')
-rw-r--r-- | lualib/lua_ffi/spf.lua | 6 |
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) |