Software /
code /
prosody
Changeset
4848:f7a4920aed6b
mod_dialback: Final sweep to get nameprep + error handling in order (hopefully)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 11 May 2012 02:04:29 +0100 |
parents | 4847:7a7cc4d98faf |
children | 4849:ea44fad88715 |
files | plugins/mod_dialback.lua |
diffstat | 1 files changed, 6 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_dialback.lua Fri May 11 01:54:36 2012 +0100 +++ b/plugins/mod_dialback.lua Fri May 11 02:04:29 2012 +0100 @@ -65,37 +65,30 @@ -- 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;