mod_invites_adhoc: Fail contact invite if user is not on current host
Only the username was being used, and the host of the requester ignored.
Luckily this only affects admins of the host. If they want to create an
account they can use the other command. If they want to create a contact
they should request from their account on this host.
--- a/mod_invites_adhoc/mod_invites_adhoc.lua Wed Jan 27 16:10:08 2021 +0000
+++ b/mod_invites_adhoc/mod_invites_adhoc.lua Thu Jan 28 07:04:11 2021 +0000
@@ -44,7 +44,15 @@
-- subscription.
module:provides("adhoc", new_adhoc("Create new contact invite", "urn:xmpp:invite#invite",
function (_, data)
- local username = split_jid(data.from);
+ local username, host = split_jid(data.from);
+ if host ~= module.host then
+ return {
+ status = "completed";
+ error = {
+ message = "This command is only available to users of "..module.host;
+ };
+ };
+ end
local invite = invites.create_contact(username, allow_user_invites, {
source = data.from
});