# HG changeset patch # User Matthew Wild # Date 1253378895 -3600 # Node ID 218f720af304670cce7a7239e1f6174275d9c98d # Parent 407f282f559e280e25c763989c3122ea48ee3946# Parent 1fc6c2822e6ba97d22e0a7b1c6debea90f580b32 Merge with 0.5 diff -r 407f282f559e -r 218f720af304 core/s2smanager.lua --- a/core/s2smanager.lua Sat Sep 19 17:42:16 2009 +0100 +++ b/core/s2smanager.lua Sat Sep 19 17:48:15 2009 +0100 @@ -37,7 +37,7 @@ 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 @@ 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);