Skip to content

Commit 8b4e116

Browse files
committed
Changed solver DNS propagation check to only succeed of any one of the checked nameservers has the required TXT entry
1 parent f172a08 commit 8b4e116

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

dnsutil.go

+3-9
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func checkDNSPropagation(fqdn, value string, resolvers []string, checkAuthoritat
240240
return checkNameservers(fqdn, value, resolvers)
241241
}
242242

243-
// checkNameservers queries each of the given nameservers for the expected TXT record.
243+
// checkNameservers checks if any of the given nameservers has the expected TXT record.
244244
func checkNameservers(fqdn, value string, nameservers []string) (bool, error) {
245245
for _, ns := range nameservers {
246246
r, err := dnsQuery(fqdn, dns.TypeTXT, []string{ns}, true)
@@ -258,23 +258,17 @@ func checkNameservers(fqdn, value string, nameservers []string) (bool, error) {
258258
return false, fmt.Errorf("NS %s returned %s for %s", ns, dns.RcodeToString[r.Rcode], fqdn)
259259
}
260260

261-
var found bool
262261
for _, rr := range r.Answer {
263262
if txt, ok := rr.(*dns.TXT); ok {
264263
record := strings.Join(txt.Txt, "")
265264
if record == value {
266-
found = true
267-
break
265+
return true, nil
268266
}
269267
}
270268
}
271-
272-
if !found {
273-
return false, nil
274-
}
275269
}
276270

277-
return true, nil
271+
return false, nil
278272
}
279273

280274
// lookupNameservers returns the authoritative nameservers for the given fqdn.

0 commit comments

Comments
 (0)