Changeset

8317:ff57b3cc5a8e

mod_pubsub: Make sure that a dataform is given to configure
author Kim Alvefur <zash@zash.se>
date Wed, 11 Oct 2017 22:18:26 +0200
parents 8316:8648cb171213
children 8318:d0a7fc7614de
files plugins/mod_pubsub/pubsub.lib.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Tue Oct 10 01:41:47 2017 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Wed Oct 11 22:18:26 2017 +0200
@@ -294,7 +294,12 @@
 		origin.send(pubsub_error_reply(stanza, "forbidden"));
 		return true;
 	end
-	local new_config, err = node_config_form:data(config.tags[1]);
+	local config_form = config:get_child("x", "jabber:x:data");
+	if not config_form then
+		origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing dataform"));
+		return true;
+	end
+	local new_config, err = node_config_form:data(config_form);
 	if not new_config then
 		origin.send(st.error_reply(stanza, "modify", "bad-request", err));
 		return true;