aboutsummaryrefslogtreecommitdiffstats
path: root/core/s2smanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-11-20 15:07:39 +0000
committerMatthew Wild <mwild1@gmail.com>2009-11-20 15:07:39 +0000
commit4ffd18797a4dba84d14d928deaec72e5c1becc97 (patch)
treeb003d9c36682ebf3a2567761d033e5f721acb82f /core/s2smanager.lua
parent9d6d5c3913346c9ad3a9777a4ce30bffa2a6d1d6 (diff)
downloadprosody-4ffd18797a4dba84d14d928deaec72e5c1becc97.tar.gz
prosody-4ffd18797a4dba84d14d928deaec72e5c1becc97.zip
s2smanager: Fail outgoing s2s connection if hostname does not pass idna_to_ascii(), thanks Flo + waqas
Diffstat (limited to 'core/s2smanager.lua')
-rw-r--r--core/s2smanager.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index 21bcb2dc..4c61eaa3 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -106,6 +106,7 @@ function send_to_host(from_host, to_host, data)
else
log("debug", "opening a new outgoing connection for this stanza");
local host_session = new_outgoing(from_host, to_host);
+
-- Store in buffer
host_session.sendq = { {tostring(data), st.reply(data)} };
log("debug", "stanza [%s] queued until connection complete", tostring(data.name));
@@ -155,7 +156,7 @@ function new_outgoing(from_host, to_host)
host_session.log = log;
end
- -- This is the first call, can't fail (the first step is DNS lookup)
+ -- Kick the connection attempting machine
attempt_connection(host_session);
if not host_session.sends2s then
@@ -183,6 +184,10 @@ function attempt_connection(host_session, err)
local from_host, to_host = host_session.from_host, host_session.to_host;
local connect_host, connect_port = idna_to_ascii(to_host), 5269;
+ if not connect_host then
+ return false;
+ end
+
if not err then -- This is our first attempt
log("debug", "First attempt to connect to %s, starting with SRV lookup...", to_host);
host_session.connecting = true;