Skip to content
Snippets Groups Projects
Commit 71e87558 authored by Tomas Krizek's avatar Tomas Krizek
Browse files

Merge branch 'rpz-errors' into 'master'

modules/policy.RPZ: log libzonefile errors as well

See merge request !780
parents 5aca5ced 165e8a88
No related branches found
No related tags found
1 merge request!780modules/policy.RPZ: log libzonefile errors as well
......@@ -13,6 +13,7 @@ Bugfixes
- trust_anchors.add(): include these TAs in .summary() (!753)
- policy module: support '#' for separating port numbers, for consistency
- fix startup on macOS+BSD when </dev/null and cqueues installed
- policy.RPZ: log problems from zone-file level of parser as well (#453)
Improvements
------------
......
......@@ -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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment