From: Marek Vavrusa Date: Thu, 21 Jan 2016 05:42:21 +0000 (-0800) Subject: daemon/trust_anchors: fixed root key fetch X-Git-Tag: v1.0.0-beta3~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32e1f331ec0c33388e56be617dbf8fd84d03fe20;p=thirdparty%2Fknot-resolver.git daemon/trust_anchors: fixed root key fetch --- diff --git a/daemon/lua/trust_anchors.lua b/daemon/lua/trust_anchors.lua index bc756648b..bf27430e1 100644 --- a/daemon/lua/trust_anchors.lua +++ b/daemon/lua/trust_anchors.lua @@ -52,7 +52,8 @@ if not ffi_ok then if not io.open(path, 'r') then local rr, err = bootstrap() if not rr then print(err) return false end - io.open(path, 'w'):write(rr..'\n') + local keyfile = assert(io.open(path, 'w')) + keyfile:write(rr..'\n') end for line in io.lines(path) do trustanchor(line) @@ -255,7 +256,6 @@ local trust_anchors = { -- Bootstrap if requested and keyfile doesn't exist if not io.open(path, 'r') then local rr, msg = bootstrap() - print(msg) if not rr then error('you MUST obtain the root TA manually, see: '.. 'http://knot-resolver.readthedocs.org/en/latest/daemon.html#enabling-dnssec') diff --git a/modules/policy/zonefile.lua b/modules/policy/zonefile.lua index 4db9f374e..c021a9cec 100644 --- a/modules/policy/zonefile.lua +++ b/modules/policy/zonefile.lua @@ -175,7 +175,9 @@ local rrparser = { file = function (path) local zs = zs_scanner_t() local ok, err = zs:open(path) - if not ok then error(err) end + if not ok then + return ok, err + end local results = {} while zs:parse() do table.insert(results, zs:current_rr())