aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-12-13 17:43:52 +0000
committerMatthew Wild <mwild1@gmail.com>2008-12-13 17:43:52 +0000
commit2e83fd69f77f90552c27526f4899e6c1fed18549 (patch)
tree1554fd10e2b361d5d36e818b692e7bfd7f7607df /core/stanza_router.lua
parentf0b2f4177166520469599a9ee9a28a0314b1f26b (diff)
downloadprosody-2e83fd69f77f90552c27526f4899e6c1fed18549.tar.gz
prosody-2e83fd69f77f90552c27526f4899e6c1fed18549.zip
Add support for dialback piggy-backing. Fixes #37. Thanks to CShadowRun for helping me test :)
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 965c77ec..24eadedc 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -72,26 +72,27 @@ function core_process_stanza(origin, stanza)
if origin.type == "c2s" then
stanza.attr.from = origin.full_jid;
end
- local to = stanza.attr.to;
+ local to, xmlns = stanza.attr.to, stanza.attr.xmlns;
local node, host, resource = jid_split(to);
local to_bare = node and (node.."@"..host) or host; -- bare JID
local from = stanza.attr.from;
local from_node, from_host, from_resource = jid_split(from);
local from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID
- if origin.type == "s2sin" then
- if origin.from_host ~= from_host then -- remote server trying to impersonate some other server?
- log("warn", "Received a stanza claiming to be from %s, over a conn authed for %s!", from, origin.from_host);
- return; -- FIXME what should we do here? does this work with subdomains?
- end
- end
--[[if to and not(hosts[to]) and not(hosts[to_bare]) and (hosts[host] and hosts[host].type ~= "local") then -- not for us?
log("warn", "stanza recieved for a non-local server");
return; -- FIXME what should we do here?
end]] -- FIXME
-- FIXME do stanzas not of jabber:client get handled by components?
- if origin.type == "s2sin" or origin.type == "c2s" then
+ if (origin.type == "s2sin" or origin.type == "c2s") and (not xmlns or xmlns == "jabber:server" or xmlns == "jabber:client") then
+ if origin.type == "s2sin" then
+ local host_status = origin.hosts[from_host];
+ if not host_status or not host_status.authed then -- remote server trying to impersonate some other server?
+ log("warn", "Received a stanza claiming to be from %s, over a conn authed for %s!", from_host, origin.from_host);
+ return; -- FIXME what should we do here? does this work with subdomains?
+ end
+ end
if not to then
core_handle_stanza(origin, stanza);
elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server