]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
lua-auth: Drop axfrfilter 5250/head
authorAki Tuomi <cmouse@cmouse.fi>
Mon, 17 Apr 2017 17:00:02 +0000 (20:00 +0300)
committerAki Tuomi <cmouse@cmouse.fi>
Mon, 17 Apr 2017 17:38:19 +0000 (20:38 +0300)
It's no longer needed.

pdns/lua-auth.cc
pdns/lua-auth.hh

index 63447e235b844bab2f04d9fc0c3608279ced4097..e5f9932571804acf7251afe7d6c345d59fb1702d 100644 (file)
@@ -46,11 +46,6 @@ string AuthLua::policycmd(const vector<string>&parts) {
   return "no policy script loaded";
 }
 
-bool AuthLua::axfrfilter(const ComboAddress& remote, const DNSName& zone, const DNSResourceRecord& in, vector<DNSResourceRecord>& out)
-{
-  return false;
-}
-
 #else
 
 
@@ -78,77 +73,6 @@ AuthLua::AuthLua(const std::string &fname)
   pthread_mutex_init(&d_lock,0);
 }
 
-bool AuthLua::axfrfilter(const ComboAddress& remote, const DNSName& zone, const DNSResourceRecord& in, vector<DNSResourceRecord>& out)
-{
-  lua_getglobal(d_lua,  "axfrfilter");
-  if(!lua_isfunction(d_lua, -1)) {
-    // cerr<<"No such function 'axfrfilter'\n";
-    lua_pop(d_lua, 1);
-    return false;
-  }
-  
-  lua_pushstring(d_lua,  remote.toString().c_str() );
-  lua_pushstring(d_lua,  zone.toString().c_str() ); // FIXME400 expose DNSName to Lua?
-  lua_pushstring(d_lua,  in.qname.toString().c_str() );
-  lua_pushnumber(d_lua,  in.qtype.getCode() );
-  lua_pushnumber(d_lua,  in.ttl );
-  lua_pushstring(d_lua,  in.content.c_str() );
-
-  if(lua_pcall(d_lua,  6, 2, 0)) { // error
-    string error=string("lua error in axfrfilter: ")+lua_tostring(d_lua, -1);
-    lua_pop(d_lua, 1);
-    throw runtime_error(error);
-    return false;
-  }
-  
-  int newres = (int)lua_tonumber(d_lua, 1); // did we handle it?
-  if(newres < 0) {
-    //cerr << "handler did not handle"<<endl;
-    lua_pop(d_lua, 2);
-    return false;
-  }
-
-  /* get the result */
-  DNSResourceRecord rr;
-  rr.ttl = 3600;
-  rr.domain_id = in.domain_id;
-
-  out.clear();
-
-  /*           1       2   3   4   */
-  /* stack:  boolean table key row */
-
-  int tableLen = getLuaTableLength(d_lua, 2);
-  for(int n=1; n < tableLen + 1; ++n) {
-    lua_pushnumber(d_lua, n);
-    lua_gettable(d_lua, 2);
-
-    uint32_t tmpnum=0;
-    if(!getFromTable("qtype", tmpnum)) 
-      rr.qtype=QType::A;
-    else
-      rr.qtype=tmpnum;
-
-    getFromTable("content", rr.content);
-    if(!getFromTable("ttl", rr.ttl))
-      rr.ttl=3600;
-
-    string qname;
-    if(!getFromTable("qname", qname))
-      rr.qname = zone;
-    else
-      rr.qname=DNSName(qname);
-
-    /* removes 'value'; keeps 'key' for next iteration */
-    lua_pop(d_lua, 1); // table
-
-    //    cerr<<"Adding content '"<<rr.content<<"'\n";
-    out.push_back(rr);
-  }
-  lua_pop(d_lua, 2); // c
-  return true;
-}
-
 struct LuaDNSPacket
 {
   DNSPacket *d_p;
index 7be4f240c2ecf29669a9ef5a434493dabd5c90c0..9bb2d8b754e18e8502238392f36f7b610be39107 100644 (file)
@@ -32,7 +32,6 @@ class AuthLua : public PowerDNSLua
 public:
   explicit AuthLua(const std::string& fname);
   // ~AuthLua();
-  bool axfrfilter(const ComboAddress& remote, const DNSName& zone, const DNSResourceRecord& in, vector<DNSResourceRecord>& out);
   DNSPacket* prequery(DNSPacket *p);
   int police(DNSPacket *req, DNSPacket *resp, bool isTcp=false);
   string policycmd(const vector<string>&parts);