Changeset

3832:0d4146cf9fbc

mod_rest: Enforce single child policy for outgoing it stanzas
author Kim Alvefur <zash@zash.se>
date Fri, 03 Jan 2020 18:29:10 +0100
parents 3831:435f5b4ebd06
children 3833:580862decd77
files mod_rest/mod_rest.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua	Fri Jan 03 16:33:40 2020 +0100
+++ b/mod_rest/mod_rest.lua	Fri Jan 03 18:29:10 2020 +0100
@@ -106,6 +106,8 @@
 	if payload.name == "iq" then
 		if payload.attr.type ~= "get" and payload.attr.type ~= "set" then
 			return errors.new({ code = 422, text = "'iq' stanza must be of type 'get' or 'set'" });
+		elseif #payload.tags ~= 1 then
+			return errors.new({ code = 422, text = "'iq' stanza must have exactly one child tag" });
 		end
 		return module:send_iq(payload):next(
 			function (result)