Diff

plugins/mod_s2s/mod_s2s.lua @ 10849:19e7092e062c

mod_c2s,mod_s2s: Use a distinct stream error for hitting stanza size limit Since this is not a real parse error, it should not be reported as such.
author Kim Alvefur <zash@zash.se>
date Sun, 31 May 2020 22:25:48 +0200
parent 10810:8a0a923e1ced
child 10850:bd2814f900dd
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Wed May 27 19:44:12 2020 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Sun May 31 22:25:48 2020 +0200
@@ -614,7 +614,11 @@
 			local ok, err = stream:feed(data);
 			if ok then return; end
 			log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300));
-			session:close("not-well-formed", nil, "Received invalid XML from remote server");
+			if err == "stanza-too-large" then
+				session:close({ condition = "policy-violation", text = "XML stanza is too big" }, nil, "Received invalid XML from remote server");
+			else
+				session:close("not-well-formed", nil, "Received invalid XML from remote server");
+			end
 		end
 	end