plugins/mod_external_services.lua
changeset 11757 c4599a7c534c
parent 11632 0807e835d3b5
child 11758 21a9b3f2a728
--- a/plugins/mod_external_services.lua	Tue Aug 31 13:03:44 2021 +0200
+++ b/plugins/mod_external_services.lua	Sun Aug 29 23:26:19 2021 +0200
@@ -175,7 +175,7 @@
 	local action = stanza.tags[1];
 
 	if origin.type ~= "c2s" then
-		origin.send(st.error_reply(stanza, "auth", "forbidden"));
+		origin.send(st.error_reply(stanza, "auth", "forbidden", "The 'port' and 'type' attributes are required."));
 		return true;
 	end
 
@@ -188,6 +188,11 @@
 
 	local requested_credentials = {};
 	for service in action:childtags("service") do
+		if not service.attr.type or not service.attr.host then
+			origin.send(st.error_reply(stanza, "modify", "bad-request"));
+			return true;
+		end
+
 		table.insert(requested_credentials, {
 				type = service.attr.type;
 				host = service.attr.host;