Software /
code /
prosody
Changeset
4837:9f1fb34cd7f8
mod_dialback: make change a bit more wide, encompass to and from and reject with proper addressing when neither are there.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Wed, 09 May 2012 23:09:06 +0000 |
parents | 4836:bda0593d3f73 |
children | 4838:661752889535 4842:88101f652174 |
files | plugins/mod_dialback.lua |
diffstat | 1 files changed, 15 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_dialback.lua Wed May 09 11:25:22 2012 +0000 +++ b/plugins/mod_dialback.lua Wed May 09 23:09:06 2012 +0000 @@ -76,21 +76,27 @@ dialback_requests[attr.from.."/"..origin.streamid] = origin; + local compat_check; if not origin.from_host then -- Just used for friendlier logging origin.from_host = nameprep(attr.from); - -- COMPAT: Fix ejabberd chopness by resetting the send function - 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 + -- COMPAT: Fix server's chopness by not including from + compat_check = true; end if not origin.to_host then -- Just used for friendlier logging - origin.to_host = attr.to; + origin.to_host = nameprep(attr.to); + -- COMPAT: Fix server's chopness by not including to + compat_check = true; + end + + if not origin.from_host and not origin.to_host then + origin.log("debug", "Improper addressing supplied, no to or from?"); + origin:close("improper-addressing"); + end + -- COMPAT: reset session.send + if compat_check then + 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 origin.log("debug", "asking %s if key %s belongs to them", attr.from, stanza[1]);