]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/trust_anchors: fixed root key fetch
authorMarek Vavrusa <marek@vavrusa.com>
Thu, 21 Jan 2016 05:42:21 +0000 (21:42 -0800)
committerMarek Vavrusa <marek@vavrusa.com>
Thu, 21 Jan 2016 05:42:21 +0000 (21:42 -0800)
daemon/lua/trust_anchors.lua
modules/policy/zonefile.lua

index bc756648bfb62b3ac993e10e8d4adc1abb5ff367..bf27430e18de0a0714c353bdbf255f3fc36bb71a 100644 (file)
@@ -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')
index 4db9f374e43a4e839c770a24cd49638926e957a0..c021a9cecc0bfa0415eba6733220c9e2fa1c3a48 100644 (file)
@@ -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())