From: bert hubert Date: Fri, 20 Dec 2013 16:08:58 +0000 (+0100) Subject: test to allow all lua steps to instruct powerdns not to answer a question X-Git-Tag: rec-3.6.0-rc1~278^2^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae7e77adf2a6a29bb6d3d5301cfddc78a6be4597;p=pdns test to allow all lua steps to instruct powerdns not to answer a question --- diff --git a/pdns/lua-recursor.cc b/pdns/lua-recursor.cc index 8c9a16fdb..cfda9ea7f 100644 --- a/pdns/lua-recursor.cc +++ b/pdns/lua-recursor.cc @@ -183,7 +183,7 @@ bool RecursorLua::passthrough(const string& func, const ComboAddress& remote, co } int newres = (int)lua_tonumber(d_lua, 1); // new rcode - if(newres < 0) { + if(newres == -1) { // cerr << "handler did not handle"<rcode == RCode::ServFail) { string trace(sr.getTrace()); diff --git a/pdns/powerdns-example-script.lua b/pdns/powerdns-example-script.lua index 31099b130..50a50166a 100644 --- a/pdns/powerdns-example-script.lua +++ b/pdns/powerdns-example-script.lua @@ -14,6 +14,12 @@ function preresolve ( remoteip, domain, qtype ) return "getFakePTRRecords", domain, "fe80::21b::77ff:0:0" end + if domain == "www.donotanswer.org." + then + print("we won't answer a query for donotanswer.org") + return -2, {} + end + if domain == "www.donotcache.org." then print("making sure www.donotcache.org will never end up in the cache", pdns.loglevels.Debug)