aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_muc_mam.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-04 13:13:37 +0100
committerKim Alvefur <zash@zash.se>2019-03-04 13:13:37 +0100
commit9c9d32e7e69af9aa59c1937b91bc41525d584144 (patch)
tree943287ef15b5ca1ab57e9fb7b1c409b11027f823 /plugins/mod_muc_mam.lua
parent0f12a9df664dc270027fae3a2a73793d0bd9d58e (diff)
downloadprosody-9c9d32e7e69af9aa59c1937b91bc41525d584144.tar.gz
prosody-9c9d32e7e69af9aa59c1937b91bc41525d584144.zip
mod_muc_mam: Validate that the FORM_TYPE of a query is as expected
Diffstat (limited to 'plugins/mod_muc_mam.lua')
-rw-r--r--plugins/mod_muc_mam.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/mod_muc_mam.lua b/plugins/mod_muc_mam.lua
index 166a5c71..963e5255 100644
--- a/plugins/mod_muc_mam.lua
+++ b/plugins/mod_muc_mam.lua
@@ -21,6 +21,7 @@ local jid_bare = require "util.jid".bare;
local jid_split = require "util.jid".split;
local jid_prep = require "util.jid".prep;
local dataform = require "util.dataforms".new;
+local get_form_type = require "util.dataforms".get_type;
local mod_muc = module:depends"muc";
local get_room_from_jid = mod_muc.get_room_from_jid;
@@ -131,7 +132,11 @@ module:hook("iq-set/bare/"..xmlns_mam..":query", function(event)
local qstart, qend;
local form = query:get_child("x", "jabber:x:data");
if form then
- local err;
+ local form_type, err = get_form_type(form);
+ if form_type ~= xmlns_mam then
+ origin.send(st.error_reply(stanza, "modify", "bad-request", "Unexpected FORM_TYPE, expected '"..xmlns_mam.."'"));
+ return true;
+ end
form, err = query_form:data(form);
if err then
origin.send(st.error_reply(stanza, "modify", "bad-request", select(2, next(err))));