comparison plugins/mod_s2s.lua @ 14106:b5eeb6730721

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 22 Mar 2026 11:28:52 +0100
parents e08e535a9945 a1fb05cbd44e
children c1469296190d
comparison
equal deleted inserted replaced
14102:a124e80d3498 14106:b5eeb6730721
17 17
18 local add_task = require "prosody.util.timer".add_task; 18 local add_task = require "prosody.util.timer".add_task;
19 local stop_timer = require "prosody.util.timer".stop; 19 local stop_timer = require "prosody.util.timer".stop;
20 local st = require "prosody.util.stanza"; 20 local st = require "prosody.util.stanza";
21 local initialize_filters = require "prosody.util.filters".initialize; 21 local initialize_filters = require "prosody.util.filters".initialize;
22 local nameprep = require "prosody.util.encodings".stringprep.nameprep; 22 local prepped_split = require "prosody.util.jid".prepped_split;
23 local new_xmpp_stream = require "prosody.util.xmppstream".new; 23 local new_xmpp_stream = require "prosody.util.xmppstream".new;
24 local s2s_new_incoming = require "prosody.core.s2smanager".new_incoming; 24 local s2s_new_incoming = require "prosody.core.s2smanager".new_incoming;
25 local s2s_new_outgoing = require "prosody.core.s2smanager".new_outgoing; 25 local s2s_new_outgoing = require "prosody.core.s2smanager".new_outgoing;
26 local s2s_destroy_session = require "prosody.core.s2smanager".destroy_session; 26 local s2s_destroy_session = require "prosody.core.s2smanager".destroy_session;
27 local uuid_gen = require "prosody.util.uuid".generate; 27 local uuid_gen = require "prosody.util.uuid".generate;
509 if session.direction == "incoming" then 509 if session.direction == "incoming" then
510 -- Send a reply stream header 510 -- Send a reply stream header
511 511
512 -- Validate to/from 512 -- Validate to/from
513 local to, from = attr.to, attr.from; 513 local to, from = attr.to, attr.from;
514 if to then to = nameprep(attr.to); end 514 local function hostprep(s)
515 if from then from = nameprep(attr.from); end 515 local node, host, res = prepped_split(s);
516 if not (node or res) then return host; end
517 end
518 if to then to = hostprep(attr.to); end
519 if from then from = hostprep(attr.from); end
516 if not to and attr.to then -- COMPAT: Some servers do not reliably set 'to' (especially on stream restarts) 520 if not to and attr.to then -- COMPAT: Some servers do not reliably set 'to' (especially on stream restarts)
517 session:close({ condition = "improper-addressing", text = "Invalid 'to' address" }); 521 session:close({ condition = "improper-addressing", text = "Invalid 'to' address" });
518 return; 522 return;
519 end 523 end
520 if not from and attr.from then -- COMPAT: Some servers do not reliably set 'from' (especially on stream restarts) 524 if not from and attr.from then -- COMPAT: Some servers do not reliably set 'from' (especially on stream restarts)