Commit 50279ffa authored by Ondřej Surý's avatar Ondřej Surý Committed by Vladimír Čunát

Remove the code that allowed FFI to be optional

parent ccbdd6a8
-- LuaJIT ffi bindings for libkres, a DNS resolver library.
-- @note Since it's statically compiled, it expects to find the symbols in the C namespace.
local ffi_ok
ffi_ok, ffi = pcall(require, 'ffi')
if not ffi_ok then
local M = { error = 'FFI not available, resolver bindings disabled.' }
setmetatable(M, {__index = function(t,k,v) error(rawget(M, 'error')) end })
return M
end
ffi = require('ffi')
local bit = require('bit')
local bor = bit.bor
local band = bit.band
......
......@@ -39,30 +39,8 @@ local function bootstrap(url, ca)
return rr
end
-- Load the module (check for FFI)
local ffi_ok, ffi = pcall(require, 'ffi')
if not ffi_ok then
-- Simplified TA management, no RFC5011 automatics
return {
-- Reuse Lua/C global function
add = trustanchor,
-- Simplified trust anchor management
config = function (path)
if not path then return end
if not io.open(path, 'r') then
local rr, err = bootstrap()
if not rr then print(err) return false end
local keyfile = assert(io.open(path, 'w'))
keyfile:write(rr..'\n')
end
for line in io.lines(path) do
trustanchor(line)
end
end,
-- Disabled
set_insecure = function () error('[ ta ] FFI not available, this function is disabled') end,
}
end
-- Load the module
local ffi = require 'ffi'
local kres = require('kres')
local C = ffi.C
......
local kres = require('kres')
local bit = require('bit')
local ffi = require('ffi')
-- Counter of unique rules
local nextid = 0
......@@ -30,10 +31,6 @@ if has_socket then
return s
end
end
local has_ffi, ffi = pcall(require, 'ffi')
if not has_ffi then
socket_client = function () return error("missing ffi library, required for this policy") end
end
local function parse_target(target)
local addr, port = target:match '([^@]*)@?(.*)'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment