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 | f42be7fe985da6ef9a738bf1b641dae44cd92439 (patch) | |
tree | 882a75f128804ea7bc0ff9429e654c05b0602aeb /plugins | |
parent | 1d8cbe75d939b191873cb5921536227ff381455b (diff) | |
download | prosody-f42be7fe985da6ef9a738bf1b641dae44cd92439.tar.gz prosody-f42be7fe985da6ef9a738bf1b641dae44cd92439.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; |