aboutsummaryrefslogtreecommitdiffstats
path: root/core/s2smanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-18 17:52:33 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-18 17:52:33 +0000
commit01c770997f61259d6e5b8ae5018aab1ef6ac0ef8 (patch)
treee58078b7e8fe4e6d58e6fdfb0be12fcea875ee29 /core/s2smanager.lua
parentf4e09200420e410c608ef9b841a0669b5c0d88a9 (diff)
downloadprosody-01c770997f61259d6e5b8ae5018aab1ef6ac0ef8.tar.gz
prosody-01c770997f61259d6e5b8ae5018aab1ef6ac0ef8.zip
Quite some changes, to:
- Small logging fix for s2smanager - Send a stream error if an incoming s2s connection is to an unrecognised hostname (fixes #11) - init_xmlhandlers now takes a table of callbacks (includes changes to net/xmpp*_listener for this) - Move sending of unavailable presence to where it should be, sessionmanager.destroy_session - Fix sending of stream errors to wrong connection
Diffstat (limited to 'core/s2smanager.lua')
-rw-r--r--core/s2smanager.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index dbfc2cb3..afc4f145 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -52,7 +52,7 @@ function send_to_host(from_host, to_host, data)
-- FIXME
if host.from_host ~= from_host then
log("error", "WARNING! This might, possibly, be a bug, but it might not...");
- log("error", "We are going to send from %s instead of %s", host.from_host, from_host);
+ log("error", "We are going to send from %s instead of %s", tostring(host.from_host), tostring(from_host));
end
host.sends2s(data);
host.log("debug", "stanza sent over "..host.type);
@@ -137,6 +137,11 @@ function streamopened(session, attr)
print(session, session.from_host, "incoming s2s stream opened");
send("<?xml version='1.0'?>");
send(stanza("stream:stream", { xmlns='jabber:server', ["xmlns:db"]='jabber:server:dialback', ["xmlns:stream"]='http://etherx.jabber.org/streams', id=session.streamid, from=session.to_host }):top_tag());
+ if session.to_host and not hosts[session.to_host] then
+ -- Attempting to connect to a host we don't serve
+ session:disconnect("host-unknown");
+ return;
+ end
elseif session.direction == "outgoing" then
-- If we are just using the connection for verifying dialback keys, we won't try and auth it
if not attr.id then error("stream response did not give us a streamid!!!"); end
@@ -218,9 +223,13 @@ end
function destroy_session(session)
(session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host));
+
+ -- FIXME: Flush sendq here/report errors to originators
+
if session.direction == "outgoing" then
hosts[session.from_host].s2sout[session.to_host] = nil;
end
+
session.conn = nil;
session.disconnect = nil;
for k in pairs(session) do