Skip to content

Commit e4c1c32

Browse files
Optional comments from #536 (#541)
Completed optional comments from #536.
1 parent 4e3fb09 commit e4c1c32

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

va/va.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -678,48 +678,48 @@ func (va VAImpl) validateDNSPersist01(task *vaTask) *core.ValidationRecord {
678678
}
679679

680680
task.Challenge.RLock()
681-
issuerNames := append([]string(nil), task.Challenge.IssuerDomainNames...)
681+
allowedIssuers := append([]string(nil), task.Challenge.IssuerDomainNames...)
682682
task.Challenge.RUnlock()
683683

684684
var syntaxErrs []string
685685
var authorizationErrs []string
686686
for _, record := range txtRecords {
687-
issuerDomainName, paramsRaw := splitIssuerDomainName(record)
688-
if !slices.Contains(issuerNames, issuerDomainName) {
687+
receivedIssuer, paramsRaw := splitIssuerDomainName(record)
688+
if !slices.Contains(allowedIssuers, receivedIssuer) {
689689
continue
690690
}
691-
issueValue, err := parseDNSPersistIssueValues(issuerDomainName, paramsRaw)
691+
params, err := parseDNSPersistIssueValues(receivedIssuer, paramsRaw)
692692
if err != nil {
693693
// We know if this record was intended for us but it is malformed,
694694
// we can continue checking other records but we should report the
695695
// syntax error if no other record authorizes the challenge.
696696
syntaxErrs = append(syntaxErrs, fmt.Sprintf(
697-
"Error parsing DNS-PERSIST-01 challenge TXT record with issuer-domain-name %q: %s", issuerDomainName, err))
697+
"Error parsing DNS-PERSIST-01 challenge TXT record with issuer-domain-name %q: %s", receivedIssuer, err))
698698
continue
699699
}
700-
if issueValue.accountURI == "" {
700+
if params.accountURI == "" {
701701
syntaxErrs = append(syntaxErrs, fmt.Sprintf(
702-
"Error parsing DNS-PERSIST-01 challenge TXT record with issuer-domain-name %q: missing mandatory accountURI parameter", issuerDomainName))
702+
"Error parsing DNS-PERSIST-01 challenge TXT record with issuer-domain-name %q: missing mandatory accountURI parameter", receivedIssuer))
703703
continue
704704
}
705-
if issueValue.accountURI != task.AccountURL {
705+
if params.accountURI != task.AccountURL {
706706
authorizationErrs = append(authorizationErrs, fmt.Sprintf(
707707
"Error parsing DNS-PERSIST-01 challenge TXT record with issuer-domain-name %q: accounturi mismatch: expected %q, got %q",
708-
issuerDomainName, task.AccountURL, issueValue.accountURI))
708+
receivedIssuer, task.AccountURL, params.accountURI))
709709
continue
710710
}
711711
// Per the dns-persist-01 specification, if the policy tag is present
712712
// parameter's defined values MUST be treated as case-insensitive.
713-
if task.Wildcard && strings.ToLower(issueValue.policy) != "wildcard" {
713+
if task.Wildcard && strings.ToLower(params.policy) != "wildcard" {
714714
authorizationErrs = append(authorizationErrs, fmt.Sprintf(
715715
"Error parsing DNS-PERSIST-01 challenge TXT record with issuer-domain-name %q: policy mismatch: expected \"wildcard\", got %q",
716-
issuerDomainName, issueValue.policy))
716+
receivedIssuer, params.policy))
717717
continue
718718
}
719-
if issueValue.persistUntil != nil && result.ValidatedAt.After(*issueValue.persistUntil) {
719+
if params.persistUntil != nil && result.ValidatedAt.After(*params.persistUntil) {
720720
authorizationErrs = append(authorizationErrs, fmt.Sprintf(
721721
"Error parsing DNS-PERSIST-01 challenge TXT record with issuer-domain-name %q, validation time %s is after persistUntil %s",
722-
issuerDomainName, result.ValidatedAt.Format(time.RFC3339), issueValue.persistUntil.Format(time.RFC3339)))
722+
receivedIssuer, result.ValidatedAt.Format(time.RFC3339), params.persistUntil.Format(time.RFC3339)))
723723
continue
724724
}
725725
return result

0 commit comments

Comments
 (0)