diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-05-11 02:04:29 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-05-11 02:04:29 +0100 |
commit | 33a9d3393d1bbad66f80926f30f1c331bc5bf664 (patch) | |
tree | 882a75f128804ea7bc0ff9429e654c05b0602aeb /plugins | |
parent | 5360fe4c3e80bdcf4fb030792cefb8f162c372c9 (diff) | |
download | prosody-33a9d3393d1bbad66f80926f30f1c331bc5bf664.tar.gz prosody-33a9d3393d1bbad66f80926f30f1c331bc5bf664.zip |
mod_dialback: Final sweep to get nameprep + error handling in order (hopefully)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_dialback.lua | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 3d1fe0e1..e47d63ed 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -65,37 +65,30 @@ module:hook("stanza/jabber:server:dialback:result", function(event) -- he wants to be identified through dialback -- We need to check the key with the Authoritative server local attr = stanza.attr; - local to, from = attr.to, attr.from; - - origin.hosts[from] = { dialback_key = stanza[1] }; + local to, from = nameprep(attr.to), nameprep(attr.from); if not hosts[to] then -- Not a host that we serve origin.log("info", "%s tried to connect to %s, which we don't serve", from, to); origin:close("host-unknown"); return true; + elseif not from then + origin:close("improper-addressing"); end + origin.hosts[from] = { dialback_key = stanza[1] }; + dialback_requests[from.."/"..origin.streamid] = origin; -- COMPAT: ejabberd, gmail and perhaps others do not always set 'to' and 'from' -- on streams. We fill in the session's to/from here instead. if not origin.from_host then - origin.from_host = nameprep(attr.from); - 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"); - end + origin.from_host = from; end if not origin.to_host then origin.to_host = nameprep(attr.to); end - if not origin.from_host or not origin.to_host then - origin.log("debug", "Improper addressing supplied, no to or from?"); - origin:close("improper-addressing"); - end - origin.log("debug", "asking %s if key %s belongs to them", from, stanza[1]); module:fire_event("route/remote", { from_host = to, to_host = from; |