Mercurial > prosody-hg
diff plugins/mod_c2s.lua @ 14154:363a79f54109 0.12
mod_c2s, mod_s2s: Add configurable limit for stanza max child elements
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 16 Apr 2026 18:53:34 +0100 |
| parents | fed0dd8dda09 |
| children | ead9e645741a |
line wrap: on
line diff
--- a/plugins/mod_c2s.lua Thu Apr 16 18:52:58 2026 +0100 +++ b/plugins/mod_c2s.lua Thu Apr 16 18:53:34 2026 +0100 @@ -30,6 +30,7 @@ local opt_keepalives = module:get_option_boolean("c2s_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true)); local unauthed_stanza_size_limit = module:get_option_number("c2s_unauthed_stanza_size_limit", 10000,1000); local authed_stanza_size_limit = module:get_option_number("c2s_stanza_size_limit", 1024*256,10000); +local max_child_elements = module:get_option_number("c2s_max_child_elements", 25000, 0); local measure_connections = module:metric("gauge", "connections", "", "Established c2s connections", {"host", "type", "ip_family"}); @@ -315,7 +316,9 @@ session.stanza_size_limit = unauthed_stanza_size_limit; - local stream = new_xmpp_stream(session, stream_callbacks, session.stanza_size_limit); + local stream = new_xmpp_stream(session, stream_callbacks, session.stanza_size_limit, { + max_elements = max_child_elements; + }); session.stream = stream; session.notopen = true;
