aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-05-10 10:46:27 +0100
committerMatthew Wild <mwild1@gmail.com>2013-05-10 10:46:27 +0100
commit0a7aa9be7afef15a53c7f46a2a58e3381a348d36 (patch)
treed9d7540d13a8f11cafcf89a9e457ce4ae6bae0ce /plugins
parentd0dcf0fa8c24226155f673eede1ed68d73a990c1 (diff)
parent1e820b5e1d6ad5ecc578bbb8de285f5694923a02 (diff)
downloadprosody-0a7aa9be7afef15a53c7f46a2a58e3381a348d36.tar.gz
prosody-0a7aa9be7afef15a53c7f46a2a58e3381a348d36.zip
Merge 0.9->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_telnet.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 2622a5f9..753e2d2c 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -207,6 +207,7 @@ function commands.help(session, data)
print [[user - Commands to create and delete users, and change their passwords]]
print [[server - Uptime, version, shutting down, etc.]]
print [[port - Commands to manage ports the server is listening on]]
+ print [[dns - Commands to manage and inspect the internal DNS resolver]]
print [[config - Reloading the configuration, etc.]]
print [[console - Help regarding the console itself]]
elseif section == "c2s" then
@@ -239,6 +240,12 @@ function commands.help(session, data)
elseif section == "port" then
print [[port:list() - Lists all network ports prosody currently listens on]]
print [[port:close(port, interface) - Close a port]]
+ elseif section == "dns" then
+ print [[dns:lookup(name, type, class) - Do a DNS lookup]]
+ print [[dns:addnameserver(nameserver) - Add a nameserver to the list]]
+ print [[dns:setnameserver(nameserver) - Replace the list of name servers with the supplied one]]
+ print [[dns:purge() - Clear the DNS cache]]
+ print [[dns:cache() - Show cached records]]
elseif section == "config" then
print [[config:reload() - Reload the server configuration. Modules may need to be reloaded for changes to take effect.]]
elseif section == "console" then
@@ -1001,6 +1008,40 @@ function def_env.xmpp:ping(localhost, remotehost)
end
end
+def_env.dns = {};
+local adns = require"net.adns";
+local dns = require"net.dns";
+
+function def_env.dns:lookup(name, typ, class)
+ local ret = "Query sent";
+ local print = self.session.print;
+ local function handler(...)
+ ret = "Got response";
+ print(...);
+ end
+ adns.lookup(handler, name, typ, class);
+ return true, ret;
+end
+
+function def_env.dns:addnameserver(...)
+ dns.addnameserver(...)
+ return true
+end
+
+function def_env.dns:setnameserver(...)
+ dns.setnameserver(...)
+ return true
+end
+
+function def_env.dns:purge()
+ dns.purge()
+ return true
+end
+
+function def_env.dns:cache()
+ return true, "Cache:\n"..tostring(dns.cache())
+end
+
-------------
function printbanner(session)