]> granicus.if.org Git - pdns/commitdiff
test to allow all lua steps to instruct powerdns not to answer a question
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 20 Dec 2013 16:08:58 +0000 (17:08 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 20 Dec 2013 16:08:58 +0000 (17:08 +0100)
pdns/lua-recursor.cc
pdns/pdns_recursor.cc
pdns/powerdns-example-script.lua

index 8c9a16fdbd46677fe1accc5e9a8d29c8d0b6bad6..cfda9ea7fda98ac6aa2501c09060bb11fe8b7766 100644 (file)
@@ -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"<<endl;
     lua_pop(d_lua, 3);
     return false;
index a0bde715bea4ee199b63d49d1ce2abf78c46674c..aae499d571297c650830f702e1545b7467485c46 100644 (file)
@@ -563,7 +563,11 @@ void startDoResolve(void *p)
       }
     }
     
-      
+    if(res == -2) {
+      delete dc;
+      dc=0;
+      return;
+    }  
     if(tracedQuery || res < 0 || res == RCode::ServFail || pw.getHeader()->rcode == RCode::ServFail)
     {
       string trace(sr.getTrace());
index 31099b130f88977df096c9aaf78818a00a4a46e6..50a50166a936485fc5ea00fe9f9c3910e398a2a5 100644 (file)
@@ -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)