From: Aki Tuomi Date: Tue, 27 Jun 2017 04:42:58 +0000 (+0300) Subject: lua-auth: Remove police and policycmd X-Git-Tag: rec-4.1.0-alpha1~23^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=073d7e22cfdc62fdb4b92eaaee315c424e861659;p=pdns lua-auth: Remove police and policycmd --- diff --git a/pdns/lua-auth.cc b/pdns/lua-auth.cc index e5f993257..67563e103 100644 --- a/pdns/lua-auth.cc +++ b/pdns/lua-auth.cc @@ -37,15 +37,6 @@ DNSPacket* AuthLua::prequery(DNSPacket *p) return 0; } -int AuthLua::police(DNSPacket *req, DNSPacket *resp, bool isTcp) -{ - return PolicyDecision::PASS; -} - -string AuthLua::policycmd(const vector&parts) { - return "no policy script loaded"; -} - #else @@ -259,78 +250,4 @@ DNSPacket* AuthLua::prequery(DNSPacket *p) } } -int AuthLua::police(DNSPacket *req, DNSPacket *resp, bool isTcp) -{ - Lock l(&d_lock); - - lua_getglobal(d_lua, "police"); - if(!lua_isfunction(d_lua, -1)) { - // cerr<<"No such function 'police'\n"; FIXME: raise Exception? check this beforehand so we can log it once? - lua_pop(d_lua, 1); - return PolicyDecision::PASS; - } - - /* wrap request */ - LuaDNSPacket* lreq = (LuaDNSPacket *)lua_newuserdata(d_lua, sizeof(LuaDNSPacket)); - lreq->d_p=req; - luaL_getmetatable(d_lua, "LuaDNSPacket"); - lua_setmetatable(d_lua, -2); - - /* wrap response */ - if(resp) { - LuaDNSPacket* lresp = (LuaDNSPacket *)lua_newuserdata(d_lua, sizeof(LuaDNSPacket)); - lresp->d_p=resp; - luaL_getmetatable(d_lua, "LuaDNSPacket"); - lua_setmetatable(d_lua, -2); - } - else - { - lua_pushnil(d_lua); - } - - lua_pushboolean(d_lua, isTcp); - - if(lua_pcall(d_lua, 3, 1, 0)) { - string error=string("lua error in police: ")+lua_tostring(d_lua, -1); - lua_pop(d_lua, 1); - theL()<&parts) { - Lock l(&d_lock); - - lua_getglobal(d_lua, "policycmd"); - if(!lua_isfunction(d_lua, -1)) { - // cerr<<"No such function 'police'\n"; FIXME: raise Exception? check this beforehand so we can log it once? - lua_pop(d_lua, 1); - return "no policycmd function in policy script"; - } - - for(vector::size_type i=1; i&parts); private: void registerLuaDNSPacket(void);