From 13e34d2329966b672ecc95cc4642cef3a541a7b4 Mon Sep 17 00:00:00 2001 From: Zack A Date: Sun, 20 Oct 2013 20:09:04 -0400 Subject: [PATCH] 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 --- pdns/lua-pdns.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pdns/lua-pdns.cc b/pdns/lua-pdns.cc index 613f382eac..9d4d4b0499 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) { -- 2.47.2