cname: stop trying to traverse cname if none have been found (#1733)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
Jürgen Brunink 2022-10-10 20:43:33 +02:00 committed by GitHub
parent 79fcc56402
commit 5e37ee3822
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -194,14 +194,18 @@ func getChallengeFqdn(domain string) string {
// Keep following CNAMEs // Keep following CNAMEs
r, err := dnsQuery(fqdn, dns.TypeCNAME, recursiveNameservers, true) r, err := dnsQuery(fqdn, dns.TypeCNAME, recursiveNameservers, true)
// Check if the domain has CNAME then use that if err != nil || r.Rcode != dns.RcodeSuccess {
if err == nil && r.Rcode == dns.RcodeSuccess { // No more CNAME records to follow, exit
fqdn = updateDomainWithCName(r, fqdn) break
continue
} }
// No more CNAME records to follow, exit // Check if the domain has CNAME then use that
break cname := updateDomainWithCName(r, fqdn)
if cname == fqdn {
break
}
fqdn = cname
} }
return fqdn return fqdn