From 38dc47caaef527891f068fb666af55f41ee3cb5b Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 21 Nov 2009 13:47:45 +0000 Subject: s2smanager: Don't tostring() the data before sending, sends2s already does this. --- core/s2smanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 4c61eaa3..aa6de317 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -391,7 +391,7 @@ function streamopened(session, attr) if send_buffer and #send_buffer > 0 then log("debug", "Sending s2s send_buffer now..."); for i, data in ipairs(send_buffer) do - session.sends2s(tostring(data)); + session.sends2s(data); send_buffer[i] = nil; end end -- cgit v1.2.3 From c3ed7fbfced3ef8d3cb76185106bed6270104783 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 21 Nov 2009 13:49:48 +0000 Subject: s2smanager: Don't log full stanza when sending outwards --- core/s2smanager.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index aa6de317..d8edaed0 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -128,7 +128,7 @@ function new_incoming(conn) open_sessions = open_sessions + 1; local w, log = conn.write, logger_init("s2sin"..tostring(conn):match("[a-f0-9]+$")); session.log = log; - session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(tostring(t)); end + session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^([^>]*>?)")); w(tostring(t)); end incoming_s2s[session] = true; add_task(connect_timeout, function () if session.conn ~= conn or @@ -317,7 +317,7 @@ function make_connect(host_session, connect_host, connect_port) cl.register_outgoing(conn, host_session); local w, log = conn.write, host_session.log; - host_session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(tostring(t)); end + host_session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^[^>]*>?")); w(tostring(t)); end conn.write(format([[]], from_host, to_host)); log("debug", "Connection attempt in progress..."); -- cgit v1.2.3 From 8da42f8d71b94aacf7b914bd9c1d1147cb33e041 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 22 Nov 2009 04:42:03 +0000 Subject: s2smanager: Update for new net.server API (s2s still doesn't work with libevent for other reasons) --- core/s2smanager.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 4c61eaa3..5dae58c9 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -128,7 +128,7 @@ function new_incoming(conn) open_sessions = open_sessions + 1; local w, log = conn.write, logger_init("s2sin"..tostring(conn):match("[a-f0-9]+$")); session.log = log; - session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(tostring(t)); end + session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(conn, tostring(t)); end incoming_s2s[session] = true; add_task(connect_timeout, function () if session.conn ~= conn or @@ -317,9 +317,9 @@ function make_connect(host_session, connect_host, connect_port) cl.register_outgoing(conn, host_session); local w, log = conn.write, host_session.log; - host_session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(tostring(t)); end + host_session.sends2s = function (t) log("debug", "sending: %s", tostring(t)); w(conn, tostring(t)); end - conn.write(format([[]], from_host, to_host)); + conn:write(format([[]], from_host, to_host)); log("debug", "Connection attempt in progress..."); add_task(connect_timeout, function () if host_session.conn ~= conn or -- cgit v1.2.3 From a1efb7e1423a9ee1e529979b098481fedce9a3a1 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 22 Nov 2009 04:53:02 +0000 Subject: s2smanager: Fix syntax error introduced in merge --- core/s2smanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index fb532a73..e1f70693 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -128,7 +128,7 @@ function new_incoming(conn) open_sessions = open_sessions + 1; local w, log = conn.write, logger_init("s2sin"..tostring(conn):match("[a-f0-9]+$")); session.log = log; - session.sends2s = function (t) log("debug", "sending: %s", (t.top_tag and t:top_tag()) or t:match("^([^>]*>?)"); w(conn, tostring(t)); end + session.sends2s = function (t) log("debug", "sending: %s", t.top_tag and t:top_tag() or t:match("^([^>]*>?)")); w(conn, tostring(t)); end incoming_s2s[session] = true; add_task(connect_timeout, function () if session.conn ~= conn or -- cgit v1.2.3 From c4742ed7810b3e10bfc6bdb55a11c31b3faf5426 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 25 Nov 2009 03:30:00 +0000 Subject: s2smanager: Log warning when trying to send a stanza from a host we don't serve, instead of a traceback (thanks stpeter) --- core/s2smanager.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 4c61eaa3..20d932e8 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -79,6 +79,10 @@ local function bounce_sendq(session) end function send_to_host(from_host, to_host, data) + if not hosts[from_host] then + log("warn", "Attempt to send stanza from %s - a host we don't serve", from_host); + return false; + end local host = hosts[from_host].s2sout[to_host]; if host then -- We have a connection to this host already -- cgit v1.2.3 From fb4bbe19bf54b792b2321d2a4e95bca9c28360d9 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 26 Nov 2009 17:17:54 +0000 Subject: s2smanager: Allow configuration of the dialback_secret in the config --- core/s2smanager.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'core/s2smanager.lua') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 666022d1..f4d46802 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -36,13 +36,12 @@ local log = logger_init("s2smanager"); local sha256_hash = require "util.hashes".sha256; -local dialback_secret = uuid_gen(); - local adns, dns = require "net.adns", require "net.dns"; local config = require "core.configmanager"; local connect_timeout = config.get("*", "core", "s2s_timeout") or 60; local dns_timeout = config.get("*", "core", "dns_timeout") or 60; local max_dns_depth = config.get("*", "core", "dns_max_depth") or 3; +local dialback_secret = config.get("*", "core", "dialback_secret") or uuid_gen(); incoming_s2s = {}; _G.prosody.incoming_s2s = incoming_s2s; -- cgit v1.2.3