diff options
-rw-r--r-- | net/http/files.lua | 2 | ||||
-rw-r--r-- | plugins/mod_admin_shell.lua | 4 | ||||
-rw-r--r-- | plugins/mod_blocklist.lua | 9 | ||||
-rw-r--r-- | plugins/mod_disco.lua | 4 | ||||
-rw-r--r-- | plugins/mod_invites_adhoc.lua | 4 | ||||
-rw-r--r-- | spec/scansion/disco_self.scs | 26 | ||||
-rw-r--r-- | util/prosodyctl/check.lua | 51 |
7 files changed, 93 insertions, 7 deletions
diff --git a/net/http/files.lua b/net/http/files.lua index 583f7514..01c46a2c 100644 --- a/net/http/files.lua +++ b/net/http/files.lua @@ -58,7 +58,7 @@ local function serve(opts) local cache = new_cache(opts.cache_size or 256); local cache_max_file_size = tonumber(opts.cache_max_file_size) or 1024 -- luacheck: ignore 431 - local base_path = opts.path; + local base_path = assert(opts.path, "invalid argument to net.http.files.path(), missing required 'path'"); local dir_indices = opts.index_files or { "index.html", "index.htm" }; local directory_index = opts.directory_index; local function serve_file(event, path) diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index ee68a64b..f2da286b 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -25,7 +25,7 @@ local prosody = _G.prosody; local unpack = table.unpack or unpack; -- luacheck: ignore 113 local iterators = require "util.iterators"; local keys, values = iterators.keys, iterators.values; -local jid_bare, jid_split, jid_join = import("util.jid", "bare", "prepped_split", "join"); +local jid_bare, jid_split, jid_join, jid_compare = import("util.jid", "bare", "prepped_split", "join", "compare"); local set, array = require "util.set", require "util.array"; local cert_verify_identity = require "util.x509".verify_identity; local envload = require "util.envload".envload; @@ -940,7 +940,7 @@ function def_env.c2s:show(match_jid, colspec) local function match(session) local jid = get_jid(session) - return (not match_jid) or jid == match_jid; + return (not match_jid) or jid_compare(jid, match_jid); end local group_by_host = true; diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua index dad06b62..6b8ce16c 100644 --- a/plugins/mod_blocklist.lua +++ b/plugins/mod_blocklist.lua @@ -322,8 +322,13 @@ local prio_in, prio_out = 100, 100; module:hook("presence/bare", drop_stanza, prio_in); module:hook("presence/full", drop_stanza, prio_in); -module:hook("message/bare", bounce_message, prio_in); -module:hook("message/full", bounce_message, prio_in); +if module:get_option_boolean("bounce_blocked_messages", false) then + module:hook("message/bare", bounce_message, prio_in); + module:hook("message/full", bounce_message, prio_in); +else + module:hook("message/bare", drop_stanza, prio_in); + module:hook("message/full", drop_stanza, prio_in); +end module:hook("iq/bare", bounce_iq, prio_in); module:hook("iq/full", bounce_iq, prio_in); diff --git a/plugins/mod_disco.lua b/plugins/mod_disco.lua index 79249c52..9d2991bf 100644 --- a/plugins/mod_disco.lua +++ b/plugins/mod_disco.lua @@ -172,6 +172,8 @@ module:hook("iq-get/bare/http://jabber.org/protocol/disco#info:query", function( if not stanza.attr.to or (expose_admins and is_admin) or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then if node and node ~= "" then local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info', node=node}); + reply:tag("feature", { var = "http://jabber.org/protocol/disco#info" }):up(); + reply:tag("feature", { var = "http://jabber.org/protocol/disco#items" }):up(); if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account local node_event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; local ret = module:fire_event("account-disco-info-node", node_event); @@ -192,6 +194,8 @@ module:hook("iq-get/bare/http://jabber.org/protocol/disco#info:query", function( else reply:tag('identity', {category='account', type='registered'}):up(); end + reply:tag("feature", { var = "http://jabber.org/protocol/disco#info" }):up(); + reply:tag("feature", { var = "http://jabber.org/protocol/disco#items" }):up(); module:fire_event("account-disco-info", { origin = origin, reply = reply }); origin.send(reply); return true; diff --git a/plugins/mod_invites_adhoc.lua b/plugins/mod_invites_adhoc.lua index bd6f0c2e..9c0660e9 100644 --- a/plugins/mod_invites_adhoc.lua +++ b/plugins/mod_invites_adhoc.lua @@ -97,7 +97,7 @@ module:provides("adhoc", new_adhoc("Create new contact invite", "urn:xmpp:invite --TODO: check errors return { status = "completed"; - form = { + result = { layout = invite_result_form; values = { uri = invite.uri; @@ -118,7 +118,7 @@ module:provides("adhoc", new_adhoc("Create new account invite", "urn:xmpp:invite --TODO: check errors return { status = "completed"; - form = { + result = { layout = invite_result_form; values = { uri = invite.uri; diff --git a/spec/scansion/disco_self.scs b/spec/scansion/disco_self.scs new file mode 100644 index 00000000..6782e884 --- /dev/null +++ b/spec/scansion/disco_self.scs @@ -0,0 +1,26 @@ +# Basic login and initial presence + +[Client] Romeo + jid: discoverer@localhost + password: password + +--------- + +Romeo connects + +Romeo sends: + <iq type="get" id="info1"> + <query xmlns="http://jabber.org/protocol/disco#info"/> + </iq> + +Romeo receives: + <iq type="result" id="info1"> + <query xmlns="http://jabber.org/protocol/disco#info" scansion:strict="false"> + <identity xmlns="http://jabber.org/protocol/disco#info" category="account" type="registered"/> + <feature var="http://jabber.org/protocol/disco#info"/> + <feature var="http://jabber.org/protocol/disco#items"/> + </query> + </iq> + +Romeo disconnects + diff --git a/util/prosodyctl/check.lua b/util/prosodyctl/check.lua index 5de8e3a6..9d460158 100644 --- a/util/prosodyctl/check.lua +++ b/util/prosodyctl/check.lua @@ -738,6 +738,57 @@ local function check(arg) end end + -- Check hostname validity + do + local idna = require "util.encodings".idna; + local invalid_hosts = {}; + local alabel_hosts = {}; + for host in it.filter("*", pairs(configmanager.getconfig())) do + local _, h, _ = jid_split(host); + if not h or not idna.to_ascii(h) then + table.insert(invalid_hosts, host); + else + for label in h:gmatch("[^%.]+") do + if label:match("^xn%-%-") then + table.insert(alabel_hosts, host); + break; + end + end + end + end + + if #invalid_hosts > 0 then + table.sort(invalid_hosts); + print(""); + print(" Your configuration contains invalid host names:"); + print(" "..table.concat(invalid_hosts, "\n ")); + print(""); + print(" Clients may not be able to log in to these hosts, or you may not be able to"); + print(" communicate with remote servers."); + print(" Use a valid domain name to correct this issue."); + end + + if #alabel_hosts > 0 then + table.sort(alabel_hosts); + print(""); + print(" Your configuration contains incorrectly-encoded hostnames:"); + for _, ahost in ipairs(alabel_hosts) do + print((" '%s' (should be '%s')"):format(ahost, idna.to_unicode(ahost))); + end + print(""); + print(" Clients may not be able to log in to these hosts, or you may not be able to"); + print(" communicate with remote servers."); + print(" To correct this issue, use the Unicode version of the domain in Prosody's config file."); + end + + if #invalid_hosts > 0 or #alabel_hosts > 0 then + print(""); + print("WARNING: Changing the name of a VirtualHost in Prosody's config file"); + print(" WILL NOT migrate any existing data (user accounts, etc.) to the new name."); + ok = false; + end + end + print("Done.\n"); end if not what or what == "dns" then |