diff options
author | Kim Alvefur <zash@zash.se> | 2021-09-06 23:21:25 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-09-06 23:21:25 +0200 |
commit | 8bde7461c18460e4fbbc87be6d0853d2a645d5ba (patch) | |
tree | 38f27bdf1f117c88f6b38bbaf66d4245645d92e1 /plugins | |
parent | 3b0eb07e5db79a12e56f8248f9d788504f3926de (diff) | |
download | prosody-8bde7461c18460e4fbbc87be6d0853d2a645d5ba.tar.gz prosody-8bde7461c18460e4fbbc87be6d0853d2a645d5ba.zip |
mod_c2s,mod_s2s: Indicate stanza size violation with condition from XEP-0205 (thanks mjk)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_c2s.lua | 6 | ||||
-rw-r--r-- | plugins/mod_s2s.lua | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index 8bd28782..1f22d871 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -339,7 +339,11 @@ function listener.onconnect(conn) 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 --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua index d800138f..cc935d21 100644 --- a/plugins/mod_s2s.lua +++ b/plugins/mod_s2s.lua @@ -746,7 +746,11 @@ local function initialize_session(session) 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 |