mod_c2s: Validate that a 'to' attribute exists at all

Prevents traceback from nameprep(nil)
remotes/origin/master
Kim Alvefur 6 years ago
parent b1516ea8f0
commit e131bbd3a4
  1. 5
      plugins/mod_c2s.lua

@ -56,6 +56,11 @@ local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
function stream_callbacks.streamopened(session, attr)
local send = session.send;
if not attr.to then
session:close{ condition = "improper-addressing",
text = "A 'to' attribute is required on stream headers" };
return;
end
local host = nameprep(attr.to);
if not host then
session:close{ condition = "improper-addressing",

Loading…
Cancel
Save