aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-05-10 01:28:09 +0200
committerKim Alvefur <zash@zash.se>2019-05-10 01:28:09 +0200
commit5e6f65812dff9f1f3e5178dc9e5738c963c25c6a (patch)
tree505ac7f6efc85a38bc48317207f552d0bc6a2898
parente663152ccca82750f06781817370f036f5bd517d (diff)
downloadprosody-5e6f65812dff9f1f3e5178dc9e5738c963c25c6a.tar.gz
prosody-5e6f65812dff9f1f3e5178dc9e5738c963c25c6a.zip
mod_admin_telnet: Check for simple commands before executing in sandbox
This makes fixing yield over pcall boundry issue easier since it would have jumped to the thread error handler instead of proceeding to checking for simple commands.
-rw-r--r--plugins/mod_admin_telnet.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index fa03840b..50753f04 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -114,6 +114,11 @@ function console:process_line(session, line)
session.env._ = line;
+ if not useglobalenv and commands[line:lower()] then
+ commands[line:lower()](session, line);
+ return;
+ end
+
local chunkname = "=console";
local env = (useglobalenv and redirect_output(_G, session)) or session.env or nil
local chunk, err = envload("return "..line, chunkname, env);
@@ -130,11 +135,6 @@ function console:process_line(session, line)
local ranok, taskok, message = pcall(chunk);
- if not (ranok or message or useglobalenv) and commands[line:lower()] then
- commands[line:lower()](session, line);
- return;
- end
-
if not ranok then
session.print("Fatal error while running command, it did not complete");
session.print("Error: "..taskok);