Mercurial > prosody-hg
comparison plugins/mod_s2s.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 | e3ddbf7f2d3f |
comparison
equal
deleted
inserted
replaced
| 14153:aa29d5144c20 | 14154:363a79f54109 |
|---|---|
| 41 local secure_domains, insecure_domains = | 41 local secure_domains, insecure_domains = |
| 42 module:get_option_set("s2s_secure_domains", {})._items, module:get_option_set("s2s_insecure_domains", {})._items; | 42 module:get_option_set("s2s_secure_domains", {})._items, module:get_option_set("s2s_insecure_domains", {})._items; |
| 43 local require_encryption = module:get_option_boolean("s2s_require_encryption", true); | 43 local require_encryption = module:get_option_boolean("s2s_require_encryption", true); |
| 44 local unauthed_stanza_size_limit = module:get_option_number("s2s_unauthed_stanza_size_limit", 10000, 1000); | 44 local unauthed_stanza_size_limit = module:get_option_number("s2s_unauthed_stanza_size_limit", 10000, 1000); |
| 45 local authed_stanza_size_limit = module:get_option_number("s2s_stanza_size_limit", 1024*512, 10000); | 45 local authed_stanza_size_limit = module:get_option_number("s2s_stanza_size_limit", 1024*512, 10000); |
| 46 local max_child_elements = module:get_option_number("s2s_max_child_elements", 25000, 0); | |
| 46 | 47 |
| 47 local measure_connections_inbound = module:metric( | 48 local measure_connections_inbound = module:metric( |
| 48 "gauge", "connections_inbound", "", | 49 "gauge", "connections_inbound", "", |
| 49 "Established incoming s2s connections", | 50 "Established incoming s2s connections", |
| 50 {"host", "type", "ip_family"} | 51 {"host", "type", "ip_family"} |
| 734 end | 735 end |
| 735 end | 736 end |
| 736 | 737 |
| 737 -- Session initialization logic shared by incoming and outgoing | 738 -- Session initialization logic shared by incoming and outgoing |
| 738 local function initialize_session(session) | 739 local function initialize_session(session) |
| 739 local stream = new_xmpp_stream(session, stream_callbacks, session.stanza_size_limit or unauthed_stanza_size_limit); | 740 local stream = new_xmpp_stream(session, stream_callbacks, session.stanza_size_limit, { |
| 741 max_elements = max_child_elements; | |
| 742 }); | |
| 740 | 743 |
| 741 session.thread = runner(function (stanza) | 744 session.thread = runner(function (stanza) |
| 742 if st.is_stanza(stanza) then | 745 if st.is_stanza(stanza) then |
| 743 core_process_stanza(session, stanza); | 746 core_process_stanza(session, stanza); |
| 744 elseif stanza.stream == "opened" then | 747 elseif stanza.stream == "opened" then |
