Skip to content

Commit

Permalink
implement getLocal() for our undocumented and unsupported Lua prequer…
Browse files Browse the repository at this point in the history
…y handler in auth
  • Loading branch information
ahupowerdns committed Sep 15, 2015
1 parent 1dc8f4d commit 995dd33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pdns/dnspacket.hh
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ public:
void setRemote(const ComboAddress*);
string getRemote() const;
Netmask getRealRemote() const;
string getLocal() const
ComboAddress getLocal() const
{
ComboAddress ca;
socklen_t len=sizeof(ca);
getsockname(d_socket, (sockaddr*)&ca, &len);
return ca.toString();
}
return ca;
}
uint16_t getRemotePort() const;

boost::optional<ComboAddress> d_anyLocal;
Expand Down
1 change: 1 addition & 0 deletions pdns/lua-auth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ void AuthLua::registerLuaDNSPacket(void) {
DNSPacket* AuthLua::prequery(DNSPacket *p)
{
lua_getglobal(d_lua,"prequery");
d_local = p->getLocal();
if(!lua_isfunction(d_lua, -1)) {
// cerr<<"No such function 'prequery'\n";
lua_pop(d_lua, 1);
Expand Down

0 comments on commit 995dd33

Please sign in to comment.