From 9825eee8c1d9ca7a245650cf4b21c64c0beb578f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 21 Oct 2018 16:04:54 +0100 Subject: MUC: Use the bare JID when performing a lookup for COMPAT with clients that don't set it (fixes #1224) The full JID is never meant to be the target of affiliation changes. --- plugins/muc/muc.lib.lua | 2 +- spec/scansion/issue1224.scs | 108 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 spec/scansion/issue1224.scs diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 8e039457..d8fd7128 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -922,7 +922,7 @@ function room_mt:handle_admin_query_set_command(origin, stanza) if not item.attr.jid and item.attr.nick then -- COMPAT Workaround for Miranda sending 'nick' instead of 'jid' when changing affiliation local occupant = self:get_occupant_by_nick(self.jid.."/"..item.attr.nick); - if occupant then item.attr.jid = occupant.jid; end + if occupant then item.attr.jid = occupant.bare_jid; end elseif item.attr.role and not item.attr.nick and item.attr.jid then -- Role changes should use nick, but we have a JID so pull the nick from that local nick = self:get_occupant_jid(item.attr.jid); diff --git a/spec/scansion/issue1224.scs b/spec/scansion/issue1224.scs new file mode 100644 index 00000000..40228182 --- /dev/null +++ b/spec/scansion/issue1224.scs @@ -0,0 +1,108 @@ +# MUC: Room registration and reserved nicknames + +[Client] Romeo + jid: user@localhost + password: password + +[Client] Juliet + jid: user2@localhost + password: password + +----- + +Romeo connects + +Romeo sends: + + + + +Romeo receives: + + + + + + + + +Romeo receives: + + +# Submit config form +Romeo sends: + + + + + http://jabber.org/protocol/muc#roomconfig + + + + + +Romeo receives: + + + +Romeo sends: + + + + + + +Romeo receives: + + +# Juliet connects, and joins the room +Juliet connects + +Juliet sends: + + + + +Juliet receives: + + +Juliet receives: + + +Juliet receives: + + +Romeo receives: + + +# Romeo makes Juliet a member of the room, however his client is buggy and only +# specifies her nickname + +Romeo sends: + + + + + + +Romeo receives: + + + + + + + + +Romeo receives: + + +Juliet receives: + + + + + + + + -- cgit v1.2.3