aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-04 13:11:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-08-04 13:11:27 +0100
commit98591e36dbdfa483130d200dbe3423611dfbab81 (patch)
tree04f8cbc6bc69a07db94dc46bcb02f18d85b16dfe /lualib
parent8d68b5d3ae90a9e34c83017f2a8248f093e4aa8a (diff)
downloadrspamd-98591e36dbdfa483130d200dbe3423611dfbab81.tar.gz
rspamd-98591e36dbdfa483130d200dbe3423611dfbab81.zip
[Minor] Make lua_ffi more flexible to use
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_ffi/init.lua8
-rw-r--r--lualib/rspamadm/mime.lua5
2 files changed, 11 insertions, 2 deletions
diff --git a/lualib/lua_ffi/init.lua b/lualib/lua_ffi/init.lua
index e5ca24a11..02b54f932 100644
--- a/lualib/lua_ffi/init.lua
+++ b/lualib/lua_ffi/init.lua
@@ -34,8 +34,7 @@ else
local ret,result_or_err = pcall(require, 'ffi')
if not ret then
- io.stderr:write('FFI support is required: please use LuaJIT or install lua-ffi')
- os.exit(1)
+ return {}
end
ffi = result_or_err
@@ -51,4 +50,9 @@ exports.common = require "lua_ffi/common"
exports.dkim = require "lua_ffi/dkim"
exports.spf = require "lua_ffi/spf"
+for k,v in pairs(ffi) do
+ -- Preserve all stuff to use lua_ffi as ffi itself
+ exports[k] = v
+end
+
return exports \ No newline at end of file
diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua
index 06b163d9b..c8b1f8450 100644
--- a/lualib/rspamadm/mime.lua
+++ b/lualib/rspamadm/mime.lua
@@ -754,6 +754,11 @@ local function sign_handler(opts)
local lua_dkim = require("lua_ffi").dkim
+ if not lua_dkim then
+ io.stderr:write('FFI support is required: please use LuaJIT or install lua-ffi')
+ os.exit(1)
+ end
+
local sign_key
if rspamd_util.file_exists(opts.key) then
sign_key = lua_dkim.load_sign_key(opts.key, 'file')