[Pdns-users] LUA script for primary server

Djerk Geurts djerk at maizymoo.com
Thu Jun 9 23:49:46 UTC 2022


> -- nxdomain runs after no result is found.
> function nxdomain(dq)
>   dquery = newDN(dq.qname:toString())
>   pdnslog("nxdomain called for: "..dquery:toString())
>   if dq.qtype == pdns.NAPTR then
>     pdnslog("Search parent wildcard record")
>     if dquery:countLabels() == 12 then
>       dquery:chopOff()
>     end
>     if dquery:countLabels() > 9 then
>       dquery:chopOff()
>     end
>     cname = dquery:toString()
>     pdnslog("Returning CNAME for: "..cname)
>     dq.addAnswer(pdns.CNAME, cname)
>     dq.rcode = 0 -- make it a normal answer
>     dq.followupFunction = "followCNAMERecords"
>     return true
>   end
>   return false
> end

Dumb-ass error, should use a “:”, not a “.” !

dq.addAnswer versus dq:addAnswer


More information about the Pdns-users mailing list