aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_dialback.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mod_dialback.lua')
-rw-r--r--plugins/mod_dialback.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua
index 4e9f9458..66082333 100644
--- a/plugins/mod_dialback.lua
+++ b/plugins/mod_dialback.lua
@@ -77,9 +77,14 @@ module:hook("stanza/jabber:server:dialback:result", function(event)
local origin, stanza = event.origin, event.stanza;
if origin.type == "s2sin_unauthed" or origin.type == "s2sin" then
- -- he wants to be identified through dialback
+ -- They want to be identified through dialback
-- We need to check the key with the Authoritative server
local attr = stanza.attr;
+ if not attr.to or not attr.from then
+ origin.log("debug", "Missing Dialback addressing (from=%q, to=%q)", attr.from, attr.to);
+ origin:close("improper-addressing");
+ return true;
+ end
local to, from = nameprep(attr.to), nameprep(attr.from);
if not hosts[to] then
@@ -89,6 +94,7 @@ module:hook("stanza/jabber:server:dialback:result", function(event)
return true;
elseif not from then
origin:close("improper-addressing");
+ return true;
end
@@ -123,7 +129,7 @@ module:hook("stanza/jabber:server:dialback:verify", function(event)
if dialback_verifying and attr.from == origin.to_host then
local valid;
if attr.type == "valid" then
- module:fire_event("s2s-authenticated", { session = dialback_verifying, host = attr.from });
+ module:fire_event("s2s-authenticated", { session = dialback_verifying, host = attr.from, mechanism = "dialback" });
valid = "valid";
else
-- Warn the original connection that is was not verified successfully
@@ -160,7 +166,7 @@ module:hook("stanza/jabber:server:dialback:result", function(event)
return true;
end
if stanza.attr.type == "valid" then
- module:fire_event("s2s-authenticated", { session = origin, host = attr.from });
+ module:fire_event("s2s-authenticated", { session = origin, host = attr.from, mechanism = "dialback" });
else
origin:close("not-authorized", "dialback authentication failed");
end