# HG changeset patch # User Kim Alvefur # Date 1630963285 -7200 # Node ID d2a9aa1c7ac8f06069b9767a038d16e3150768ab # Parent 071715a18394c1c72cd9063fee6b94a11d0def47 mod_c2s,mod_s2s: Indicate stanza size violation with condition from XEP-0205 (thanks mjk) diff -r 071715a18394 -r d2a9aa1c7ac8 doc/doap.xml --- a/doc/doap.xml Sun Sep 05 18:42:44 2021 +0200 +++ b/doc/doap.xml Mon Sep 06 23:21:25 2021 +0200 @@ -446,6 +446,13 @@ + + 0.12.0 + stanza size limits, bandwidth limits, stanza-too-big error condition + + + + 1.2 0.2.0 diff -r 071715a18394 -r d2a9aa1c7ac8 plugins/mod_c2s.lua --- a/plugins/mod_c2s.lua Sun Sep 05 18:42:44 2021 +0200 +++ b/plugins/mod_c2s.lua Mon Sep 06 23:21:25 2021 +0200 @@ -339,7 +339,11 @@ if not ok then log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300)); if err == "stanza-too-large" then - session:close({ condition = "policy-violation", text = "XML stanza is too big" }); + session:close({ + condition = "policy-violation", + text = "XML stanza is too big", + extra = st.stanza("stanza-too-big", { xmlns = 'urn:xmpp:errors' }), + }); else session:close("not-well-formed"); end diff -r 071715a18394 -r d2a9aa1c7ac8 plugins/mod_s2s.lua --- a/plugins/mod_s2s.lua Sun Sep 05 18:42:44 2021 +0200 +++ b/plugins/mod_s2s.lua Mon Sep 06 23:21:25 2021 +0200 @@ -746,7 +746,11 @@ if ok then return; end log("debug", "Received invalid XML (%s) %d bytes: %q", err, #data, data:sub(1, 300)); if err == "stanza-too-large" then - session:close({ condition = "policy-violation", text = "XML stanza is too big" }, nil, "Received invalid XML from remote server"); + session:close({ + condition = "policy-violation", + text = "XML stanza is too big", + extra = st.stanza("stanza-too-big", { xmlns = 'urn:xmpp:errors' }), + }, nil, "Received invalid XML from remote server"); else session:close("not-well-formed", nil, "Received invalid XML from remote server"); end