const auto& storage = r.d_name.getStorage();
record->name = storage.data();
record->name_len = storage.size();
- } else {
+ }
+ else {
std::string name = r.d_name.toStringNoDot();
record->name_len = name.size();
record->name = ref->insert(std::move(name))->c_str();
if qname == "example" and qtype == pdns.SOA
then
local addr = ffi.string(ffi.C.pdns_postresolve_ffi_handle_get_authip(ref))
- pdnslog("XXXX "..addr)
if string.sub(addr, -3) ~= ".10" and string.sub(addr, -3) ~= ".18"
then
-- signal error by clearing all
ffi.C.pdns_postresolve_ffi_handle_clear_records(ref)
end
- -- as a bonug check from which auth the data came
+ local qaddr = ffi.new("const char *[1]")
+ local qlen = ffi.new("size_t [1]")
+ ffi.C.pdns_postresolve_ffi_handle_get_qname_raw(ref, qaddr, qlen)
+ local q = ffi.string(qaddr[0], qlen[0])
+ if tohex(q) ~= "076578616D706C6500"
+ then
+ -- pdnslog("Error "..tohex(q))
+ -- signal error by clearing all
+ ffi.C.pdns_postresolve_ffi_handle_clear_records(ref)
+ end
+ -- as a bonus check from which auth the data came
local addr = ffi.new("const void *[1]")
local len = ffi.new("size_t [1]")
ffi.C.pdns_postresolve_ffi_handle_get_authip_raw(ref, addr, len)
-- signal error by clearing all
ffi.C.pdns_postresolve_ffi_handle_clear_records(ref)
end
-
ffi.C.pdns_postresolve_ffi_handle_set_appliedpolicy_kind(ref, "pdns_policy_kind_noaction")
return true
end
end
i = i + 1
end
+ -- loop again using raw
+ i = 0
+ while ffi.C.pdns_postresolve_ffi_handle_get_record(ref, i, record, true)
+ do
+ local content = ffi.string(record.content, record.content_len)
+ local name = ffi.string(record.name, record.name_len)
+ --pdnslog("R "..tohex(name))
+ if tohex(name) ~= "0F706F73747265736F6C76655F666669076578616D706C6500"
+ then
+ ffi.C.pdns_postresolve_ffi_handle_clear_records(ref)
+ end
+ i = i + 1
+ end
return true
end
"""