From: Zack A Date: Mon, 21 Oct 2013 00:09:04 +0000 (-0400) Subject: Issue #1067. Moved pdnslog and matchnetmask to lines 231-235 to allow for these funct... X-Git-Tag: rec-3.6.0-rc1~390^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13e34d2329966b672ecc95cc4642cef3a541a7b4;p=pdns Issue #1067. Moved pdnslog and matchnetmask to lines 231-235 to allow for these functions to be globally accessible outside the scope of the pdns-recursor pre-reserved functions --- diff --git a/pdns/lua-pdns.cc b/pdns/lua-pdns.cc index 613f382ea..9d4d4b049 100644 --- a/pdns/lua-pdns.cc +++ b/pdns/lua-pdns.cc @@ -225,8 +225,15 @@ int logLua(lua_State *lua) PowerDNSLua::PowerDNSLua(const std::string& fname) { + d_lua = luaL_newstate(); + lua_pushcfunction(d_lua, netmaskMatchLua); + lua_setglobal(d_lua, "matchnetmask"); + + lua_pushcfunction(d_lua, logLua); + lua_setglobal(d_lua, "pdnslog"); + #ifndef LUA_VERSION_NUM luaopen_base(d_lua); luaopen_string(d_lua); @@ -239,19 +246,13 @@ PowerDNSLua::PowerDNSLua(const std::string& fname) throw runtime_error(string("Error loading Lua file '")+fname+"': "+ string(lua_isstring(d_lua, -1) ? lua_tostring(d_lua, -1) : "unknown error")); lua_settop(d_lua, 0); - - lua_pushcfunction(d_lua, netmaskMatchLua); - lua_setglobal(d_lua, "matchnetmask"); - - lua_pushcfunction(d_lua, logLua); - lua_setglobal(d_lua, "pdnslog"); lua_pushcfunction(d_lua, setVariableLua); lua_setglobal(d_lua, "setvariable"); lua_pushcfunction(d_lua, getLocalAddressLua); lua_setglobal(d_lua, "getlocaladdress"); - + lua_newtable(d_lua); for(vector::const_iterator iter = QType::names.begin(); iter != QType::names.end(); ++iter) {