diff options
author | Kim Alvefur <zash@zash.se> | 2020-01-24 23:28:15 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-01-24 23:28:15 +0100 |
commit | 48f0b3b44cb1de52fa358161814cf5ce2aab1b45 (patch) | |
tree | b231fd41fca2d48ce2b997d6ee0d982150bfc3c3 /plugins | |
parent | 00d22ada7bf9071efb25c900a1f698184109e4ad (diff) | |
parent | a6080a215e46540e68bd78b46c947d57a889b66e (diff) | |
download | prosody-48f0b3b44cb1de52fa358161814cf5ce2aab1b45.tar.gz prosody-48f0b3b44cb1de52fa358161814cf5ce2aab1b45.zip |
Merge 0.11->trunk
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_admin_telnet.lua | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 7df63da9..5ffd40e0 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -1177,36 +1177,49 @@ end def_env.dns = {}; local adns = require"net.adns"; -local dns = require"net.dns"; + +local function get_resolver(session) + local resolver = session.dns_resolver; + if not resolver then + resolver = adns.resolver(); + session.dns_resolver = resolver; + end + return resolver; +end function def_env.dns:lookup(name, typ, class) + local resolver = get_resolver(self.session); local ret = "Query sent"; local print = self.session.print; local function handler(...) ret = "Got response"; print(...); end - adns.lookup(handler, name, typ, class); + resolver:lookup(handler, name, typ, class); return true, ret; end function def_env.dns:addnameserver(...) - dns._resolver:addnameserver(...) + local resolver = get_resolver(self.session); + resolver._resolver:addnameserver(...) return true end function def_env.dns:setnameserver(...) - dns._resolver:setnameserver(...) + local resolver = get_resolver(self.session); + resolver._resolver:setnameserver(...) return true end function def_env.dns:purge() - dns.purge() + local resolver = get_resolver(self.session); + resolver._resolver:purge() return true end function def_env.dns:cache() - return true, "Cache:\n"..tostring(dns.cache()) + local resolver = get_resolver(self.session); + return true, "Cache:\n"..tostring(resolver._resolver.cache) end def_env.http = {}; |