aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_dialback.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-05-11 01:53:32 +0100
committerMatthew Wild <mwild1@gmail.com>2012-05-11 01:53:32 +0100
commitfd5826e721ca1ffa36bd4bb69cef86d1629e2d50 (patch)
treec6d3dd80f6be503871411f837d01ca82f344457e /plugins/mod_dialback.lua
parentf73fb5fdd4a9f66a5539c33be875d4d9fe63b5d1 (diff)
parentaceb78e16b9acb74f6d3e3625312126a06cc65b7 (diff)
downloadprosody-fd5826e721ca1ffa36bd4bb69cef86d1629e2d50.tar.gz
prosody-fd5826e721ca1ffa36bd4bb69cef86d1629e2d50.zip
Merge with Maranda
Diffstat (limited to 'plugins/mod_dialback.lua')
-rw-r--r--plugins/mod_dialback.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua
index 8f69b55a..c2392502 100644
--- a/plugins/mod_dialback.lua
+++ b/plugins/mod_dialback.lua
@@ -15,6 +15,7 @@ local log = module._log;
local st = require "util.stanza";
local sha256_hash = require "util.hashes".sha256;
+local nameprep = require "util.encodings".stringprep.nameprep;
local xmlns_stream = "http://etherx.jabber.org/streams";
@@ -79,8 +80,21 @@ module:hook("stanza/jabber:server:dialback:result", function(event)
-- 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 = from; end
- if not origin.to_host then origin.to_host = to; end
+ 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
+ end
+ if not origin.to_host then
+ origin.to_host = nameprep(attr.to);
+ 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
origin.log("debug", "asking %s if key %s belongs to them", from, stanza[1]);
module:fire_event("route/remote", {