# HG changeset patch # User Matthew Wild # Date 1406786295 -3600 # Node ID c9730926002bf36f97a7c7f84c17c0c5aa09b7fd # Parent 5926f01e5cd24cbc7893e85058ed86069418d35c prosodyctl: Improve JID splitting and normalization for adduser/passwd/deluser diff -r 5926f01e5cd2 -r c9730926002b prosodyctl --- a/prosodyctl Thu Jul 31 06:56:21 2014 +0100 +++ b/prosodyctl Thu Jul 31 06:58:15 2014 +0100 @@ -268,6 +268,8 @@ 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 @@ 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 @@ 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 @@ 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]]