aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_dialback.lua
diff options
context:
space:
mode:
authorMarco Cirillo <maranda@lightwitch.org>2012-05-09 23:09:06 +0000
committerMarco Cirillo <maranda@lightwitch.org>2012-05-09 23:09:06 +0000
commit560420165a457a4f853da7a91bc779fca9d0488a (patch)
treec6251ed8df31aa5d840cc457f510e2df6fb0075c /plugins/mod_dialback.lua
parenta5e360e6739be4ea3019f4129a55c74b124d9153 (diff)
downloadprosody-560420165a457a4f853da7a91bc779fca9d0488a.tar.gz
prosody-560420165a457a4f853da7a91bc779fca9d0488a.zip
mod_dialback: make change a bit more wide, encompass to and from and reject with proper addressing when neither are there.
Diffstat (limited to 'plugins/mod_dialback.lua')
-rw-r--r--plugins/mod_dialback.lua24
1 files changed, 15 insertions, 9 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua
index 5d32fdb2..f3b9e3cf 100644
--- a/plugins/mod_dialback.lua
+++ b/plugins/mod_dialback.lua
@@ -76,21 +76,27 @@ module:hook("stanza/jabber:server:dialback:result", function(event)
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]);