Skip to content
Snippets Groups Projects

modules/policy.RPZ: log libzonefile errors as well

Merged Vladimír Čunát requested to merge rpz-errors into master
Files
2
+ 11
2
@@ -362,8 +362,17 @@ local function rpz_parse(action, path)
-- Policy triggers @NYI@
}
local parser = require('zonefile').new()
if not parser:open(path) then error(string.format('failed to parse "%s"', path)) end
while parser:parse() do
local ok, errstr = parser:open(path)
if not ok then
error(string.format('failed to parse "%s": %s', path, errstr or "unknown error"))
end
while true do
ok, errstr = parser:parse()
if errstr then
log('[poli] RPZ %s:%d: %s', path, tonumber(parser.line_counter), errstr)
end
if not ok then break end
local name = ffi.string(parser.r_owner, parser.r_owner_length)
local name_action = ffi.string(parser.r_data, parser.r_data_length)
rules[name] = action_map[name_action]
Loading