aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-10-02 17:56:24 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-10-02 17:56:24 +0500
commit993f73525583958fc68e23aba9255b2d2efaea4c (patch)
tree74bbb2cbad1708e4aa925b9682a6348c8a8e8d59 /plugins/muc/muc.lib.lua
parent902cc7dea99f105d2143e6e55a211e846ec50fe7 (diff)
downloadprosody-993f73525583958fc68e23aba9255b2d2efaea4c.tar.gz
prosody-993f73525583958fc68e23aba9255b2d2efaea4c.zip
MUC: Prep given JID when changing affiliation.
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r--plugins/muc/muc.lib.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 35bde4c6..93706b07 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -11,6 +11,7 @@ local datetime = require "util.datetime";
local jid_split = require "util.jid".split;
local jid_bare = require "util.jid".bare;
+local jid_prep = require "util.jid".prep;
local st = require "util.stanza";
local log = require "util.logger".init("mod_muc");
local multitable_new = require "util.multitable".new;
@@ -412,6 +413,13 @@ function room_mt:handle_to_room(origin, stanza) -- presence changes and groupcha
if item and item.name == "item" then
if type == "set" then
local callback = function() origin.send(st.reply(stanza)); end
+ if item.attr.jid then -- Validate provided JID
+ item.attr.jid = jid_prep(item.attr.jid);
+ if not item.attr.jid then
+ origin.send(st.error_reply(stanza, "modify", "jid-malformed"));
+ return;
+ end
+ end
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._occupants[self.jid.."/"..item.attr.nick];
if occupant then item.attr.jid = occupant.jid; end