# HG changeset patch # User Matthew Wild # Date 1743438650 -3600 # Node ID c8e534b4f2e240b35035ba34c429a0d4b6189d5a # Parent 471b676e64ebe9587d4421f046bf9e1259a2232e mod_admin_shell, prosodyctl shell: Report command failure when no password entered (fixes #1907) diff -r 471b676e64eb -r c8e534b4f2e2 plugins/mod_admin_shell.lua --- a/plugins/mod_admin_shell.lua Mon Mar 31 16:25:09 2025 +0100 +++ b/plugins/mod_admin_shell.lua Mon Mar 31 17:30:50 2025 +0100 @@ -205,7 +205,13 @@ event.origin.send(st.stanza("repl-result", { type = "error" }):text("Internal error - unexpected input")); return true; end - input_promise.resolve(event.stanza:get_text()); + local status = event.stanza.attr.status or "submit"; + local text = event.stanza:get_text(); + if status == "submit" then + input_promise.resolve(text); + else + input_promise.reject(status == "cancel" and (text ~= "" and text) or "cancelled"); + end return true; end); diff -r 471b676e64eb -r c8e534b4f2e2 util/prosodyctl/shell.lua --- a/util/prosodyctl/shell.lua Mon Mar 31 16:25:09 2025 +0100 +++ b/util/prosodyctl/shell.lua Mon Mar 31 17:30:50 2025 +0100 @@ -134,7 +134,11 @@ end if stanza.attr.type == "password" then local password = human_io.read_password(); - client.send(st.stanza("repl-requested-input", { type = stanza.attr.type, id = stanza.attr.id }):text(password)); + client.send(st.stanza("repl-requested-input", { + type = stanza.attr.type; + id = stanza.attr.id; + status = password and "submit" or "cancel"; + }):text(password or "")); else io.stderr:write("Internal error - unexpected input request type "..tostring(stanza.attr.type).."\n"); os.exit(1);