From 2e83fd69f77f90552c27526f4899e6c1fed18549 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 13 Dec 2008 17:43:52 +0000 Subject: Add support for dialback piggy-backing. Fixes #37. Thanks to CShadowRun for helping me test :) --- core/stanza_router.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'core/stanza_router.lua') 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 -- cgit v1.2.3