aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-07-31 06:58:15 +0100
committerMatthew Wild <mwild1@gmail.com>2014-07-31 06:58:15 +0100
commitb9d13e10f334f614d86cd219b689ff38a5aad01c (patch)
treef6f4bf47a0933998931795d387943abc66487e31 /prosodyctl
parent4fc9f0b8f590f64c2dd00455237ef5d46ded0d08 (diff)
downloadprosody-b9d13e10f334f614d86cd219b689ff38a5aad01c.tar.gz
prosody-b9d13e10f334f614d86cd219b689ff38a5aad01c.zip
prosodyctl: Improve JID splitting and normalization for adduser/passwd/deluser
Diffstat (limited to 'prosodyctl')
-rwxr-xr-xprosodyctl8
1 files changed, 5 insertions, 3 deletions
diff --git a/prosodyctl b/prosodyctl
index d341a75b..6a6414f6 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -268,6 +268,8 @@ local show_yesno = prosodyctl.show_yesno;
local show_prompt = prosodyctl.show_prompt;
local read_password = prosodyctl.read_password;
+local jid_split = require "util.jid".prepped_split;
+
local prosodyctl_timeout = (config.get("*", "prosodyctl_timeout") or 5) * 2;
-----------------------
local commands = {};
@@ -278,7 +280,7 @@ function commands.adduser(arg)
show_usage([[adduser JID]], [[Create the specified user account in Prosody]]);
return 1;
end
- local user, host = arg[1]:match("([^@]+)@(.+)");
+ local user, host = jid_split(arg[1]);
if not user and host then
show_message [[Failed to understand JID, please supply the JID you want to create]]
show_usage [[adduser user@host]]
@@ -317,7 +319,7 @@ function commands.passwd(arg)
show_usage([[passwd JID]], [[Set the password for the specified user account in Prosody]]);
return 1;
end
- local user, host = arg[1]:match("([^@]+)@(.+)");
+ local user, host = jid_split(arg[1])
if not user and host then
show_message [[Failed to understand JID, please supply the JID you want to set the password for]]
show_usage [[passwd user@host]]
@@ -356,7 +358,7 @@ function commands.deluser(arg)
show_usage([[deluser JID]], [[Permanently remove the specified user account from Prosody]]);
return 1;
end
- local user, host = arg[1]:match("([^@]+)@(.+)");
+ local user, host = jid_split(arg[1]);
if not user and host then
show_message [[Failed to understand JID, please supply the JID you want to set the password for]]
show_usage [[passwd user@host]]