# HG changeset patch # User Kim Alvefur # Date 1449602370 -3600 # Node ID c515f9491ce619a141e5e3f4f5068383694198c0 # Parent bcaa553de6e86bdde88d85eda1773412e1c15fef MUC: Process only options that are included in a form (Fixes #521) diff -r bcaa553de6e8 -r c515f9491ce6 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Tue Dec 08 20:16:49 2015 +0100 +++ b/plugins/muc/muc.lib.lua Tue Dec 08 20:19:30 2015 +0100 @@ -674,7 +674,7 @@ if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Not a submitted form")); return; end - local fields = self:get_form_layout(stanza.attr.from):data(form); + local fields, errors, present = self:get_form_layout(stanza.attr.from):data(form); if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration")); return; @@ -683,8 +683,8 @@ local changed = {}; local function handle_option(name, field, allowed) - local new = fields[field]; - if new == nil then return; end + local new, err, included = fields[field], errors[field], present[field]; + if not included then return; end if allowed and not allowed[new] then return; end if new == self["get_"..name](self) then return; end changed[name] = true;