Commit aea3484c authored by Marek Vavruša's avatar Marek Vavruša

daemon/lua: kr_query_t.name() includes last root label

parent 81555e54
......@@ -334,7 +334,7 @@ ffi.metatype( knot_pkt_t, {
local kr_query_t = ffi.typeof('struct kr_query')
ffi.metatype( kr_query_t, {
__index = {
name = function(qry, new_name) return ffi.string(qry.sname) end,
name = function(qry, new_name) return ffi.string(qry.sname, knot.knot_dname_size(qry.sname)) end,
next = function(qry)
assert(qry)
return C.kr_rplan_next(qry)
......@@ -400,7 +400,10 @@ local kres = {
pkt_t = function (udata) return ffi.cast('knot_pkt_t *', udata) end,
request_t = function (udata) return ffi.cast('struct kr_request *', udata) end,
-- Global API functions
str2dname = function(name) return ffi.string(ffi.gc(C.knot_dname_from_str(nil, name, 0), C.free)) end,
str2dname = function(name)
local dname = ffi.gc(C.knot_dname_from_str(nil, name, 0), C.free)
return ffi.string(dname, knot.knot_dname_size(dname))
end,
dname2str = dname2str,
rr2str = rr2str,
str2ip = function (ip)
......
......@@ -63,7 +63,7 @@ local function rpz_parse(action, path)
-- Policy triggers @NYI@
}
local parser = require('zonefile').parser(function (p)
local name = ffi.string(p.r_owner, p.r_owner_length - 1)
local name = ffi.string(p.r_owner, p.r_owner_length)
local action = ffi.string(p.r_data, p.r_data_length)
rules[name] = action_map[action]
end, function (p)
......@@ -193,6 +193,6 @@ local private_zones = {
policy.to_domains(private_zones)
-- @var Default rules
policy.rules = { policy.suffix_common(policy.DENY, private_zones, '\4arpa') }
policy.rules = { policy.suffix_common(policy.DENY, private_zones, '\4arpa\0') }
return policy
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