Comparison

plugins/mod_s2s/mod_s2s.lua @ 10381:66fa45d24481

mod_s2s: Only nameprep stream to/from addresses if they are present Prevents traceback from nameprep(nil)
author Kim Alvefur <zash@zash.se>
date Sat, 02 Nov 2019 15:43:17 +0100
parent 10311:1bb1e16f24b0
child 10403:3b82e9df5a7a
comparison
equal deleted inserted replaced
10380:18685a5e362e 10381:66fa45d24481
325 325
326 if session.direction == "incoming" then 326 if session.direction == "incoming" then
327 -- Send a reply stream header 327 -- Send a reply stream header
328 328
329 -- Validate to/from 329 -- Validate to/from
330 local to, from = nameprep(attr.to), nameprep(attr.from); 330 local to, from = attr.to, attr.from;
331 if to then to = nameprep(attr.to); end
332 if from then from = nameprep(attr.from); end
331 if not to and attr.to then -- COMPAT: Some servers do not reliably set 'to' (especially on stream restarts) 333 if not to and attr.to then -- COMPAT: Some servers do not reliably set 'to' (especially on stream restarts)
332 session:close({ condition = "improper-addressing", text = "Invalid 'to' address" }); 334 session:close({ condition = "improper-addressing", text = "Invalid 'to' address" });
333 return; 335 return;
334 end 336 end
335 if not from and attr.from then -- COMPAT: Some servers do not reliably set 'from' (especially on stream restarts) 337 if not from and attr.from then -- COMPAT: Some servers do not reliably set 'from' (especially on stream restarts)