Skip to content

Commit aba1313

Browse files
committed
Fix edge case panic in case of repeated account recreation failure (fix #354)
1 parent 14972fd commit aba1313

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

acmeissuer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ func (am *ACMEIssuer) doIssue(ctx context.Context, csr *x509.CertificateRequest,
490490

491491
// do this in a loop because there's an error case that may necessitate a retry, but not more than once
492492
var certChains []acme.Certificate
493-
for i := 0; i < 2; i++ {
493+
for range 2 {
494494
am.Logger.Info("using ACME account",
495495
zap.String("account_id", params.Account.Location),
496496
zap.Strings("account_contact", params.Account.Contact))
@@ -523,11 +523,11 @@ func (am *ACMEIssuer) doIssue(ctx context.Context, csr *x509.CertificateRequest,
523523
}
524524
return nil, usingTestCA, fmt.Errorf("%v %w (ca=%s)", nameSet, err, client.acmeClient.Directory)
525525
}
526-
if len(certChains) == 0 {
527-
return nil, usingTestCA, fmt.Errorf("no certificate chains")
528-
}
529526
break
530527
}
528+
if len(certChains) == 0 {
529+
return nil, usingTestCA, fmt.Errorf("no certificate chains")
530+
}
531531

532532
preferredChain := am.selectPreferredChain(certChains)
533533

0 commit comments

Comments
 (0)