diff options
author | Marco Cirillo <maranda@lightwitch.org> | 2012-05-09 11:25:22 +0000 |
---|---|---|
committer | Marco Cirillo <maranda@lightwitch.org> | 2012-05-09 11:25:22 +0000 |
commit | a5e360e6739be4ea3019f4129a55c74b124d9153 (patch) | |
tree | e46e85804933a17809fc6952f1b1f95f70583dd3 /plugins | |
parent | 47594d8fafde539e6258f9c2d0dd6d895b72908a (diff) | |
download | prosody-a5e360e6739be4ea3019f4129a55c74b124d9153.tar.gz prosody-a5e360e6739be4ea3019f4129a55c74b124d9153.zip |
mod_dialback: add better safe then sorry nameprepping to the from attribute.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_dialback.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index cc076db5..5d32fdb2 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -15,6 +15,7 @@ local log = module._log; local st = require "util.stanza"; local sha256_hash = require "util.hashes".sha256; +local nameprep = require "util.encodings".stringprep.nameprep; local xmlns_stream = "http://etherx.jabber.org/streams"; @@ -77,10 +78,15 @@ module:hook("stanza/jabber:server:dialback:result", function(event) if not origin.from_host then -- Just used for friendlier logging - origin.from_host = attr.from; + origin.from_host = nameprep(attr.from); -- COMPAT: Fix ejabberd chopness by resetting the send function - origin.log("debug", "Remote server didn't specify a from attr, resetting session.send now that we know where to knock to."); - origin.send = function(stanza) hosts[attr.to].events.fire_event("route/remote", { from_host = origin.to_host, to_host = origin.from_host, stanza = stanza}); end + if not origin.from_host then + origin.log("debug", "We need to know where to connect but remote server blindly refuses to tell us and to comply to specs, closing connection."); + origin:close("invalid-from"); + else + origin.log("debug", "Remote server didn't specify a from attr, resetting session.send now that we know where to knock to."); + origin.send = function(stanza) hosts[attr.to].events.fire_event("route/remote", { from_host = origin.to_host, to_host = origin.from_host, stanza = stanza}); end + end end if not origin.to_host then -- Just used for friendlier logging |