aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-09-19 17:48:15 +0100
committerMatthew Wild <mwild1@gmail.com>2009-09-19 17:48:15 +0100
commit1c92cd5b147a33c0d1abc6bd435b90356f7d6d03 (patch)
tree95e9fd6529ce2aa1eb5d2c62770b0022bf3d64f2 /core
parent818bece2e6d8afbb42001c4ca5f23ff4a808123d (diff)
parent711ad31a2a9c6eb20d6a0492a8a18277be7760e9 (diff)
downloadprosody-1c92cd5b147a33c0d1abc6bd435b90356f7d6d03.tar.gz
prosody-1c92cd5b147a33c0d1abc6bd435b90356f7d6d03.zip
Merge with 0.5
Diffstat (limited to 'core')
-rw-r--r--core/s2smanager.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index 2affe486..3e6c24ac 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -37,7 +37,7 @@ local sha256_hash = require "util.hashes".sha256;
local dialback_secret = uuid_gen();
-local adns = require "net.adns";
+local adns, dns = require "net.adns", require "net.dns";
local dns_timeout = config.get("*", "core", "dns_timeout") or 60;
@@ -241,6 +241,16 @@ function try_connect(host_session, connect_host, connect_port)
handle = adns.lookup(function (reply)
handle = nil;
host_session.connecting = nil;
+
+ -- COMPAT: This is a compromise for all you CNAME-(ab)users :)
+ if not (reply and reply[1] and reply[1].a) then
+ reply = dns.peek(connect_host, "CNAME", "IN");
+ while reply and reply[1] and not reply[1].a and reply[1].cname do
+ reply = dns.peek(reply[1].cname, "A", "IN") or dns.peek(reply[1].cname, "CNAME", "IN");
+ end
+ end
+ -- end of CNAME resolving
+
if reply and reply[1] and reply[1].a then
log("debug", "DNS reply for %s gives us %s", connect_host, reply[1].a);
return make_connect(host_session, reply[1].a, connect_port);