CA: Deref regID and orderID in orphaned precert log (#4443)

This commit is contained in:
Jacob Hoffman-Andrews 2019-09-23 09:39:38 -07:00 committed by Daniel McCarney
parent f5453fd33a
commit e9f91e3daa
2 changed files with 8 additions and 1 deletions

View File

@ -471,7 +471,7 @@ func (ca *CertificateAuthorityImpl) IssuePrecertificate(ctx context.Context, iss
if err != nil { if err != nil {
err = berrors.InternalServerError(err.Error()) err = berrors.InternalServerError(err.Error())
ca.log.AuditErrf("Failed RPC to store at SA, orphaning precertificate: serial=[%s] cert=[%s] err=[%v], regID=[%d], orderID=[%d]", ca.log.AuditErrf("Failed RPC to store at SA, orphaning precertificate: serial=[%s] cert=[%s] err=[%v], regID=[%d], orderID=[%d]",
serialHex, hex.EncodeToString(precertDER), err, issueReq.RegistrationID, issueReq.OrderID) serialHex, hex.EncodeToString(precertDER), err, *issueReq.RegistrationID, *issueReq.OrderID)
if ca.orphanQueue != nil { if ca.orphanQueue != nil {
ca.queueOrphan(&orphanedCert{ ca.queueOrphan(&orphanedCert{
DER: precertDER, DER: precertDER,

View File

@ -15,6 +15,7 @@ import (
"math/big" "math/big"
"os" "os"
"sort" "sort"
"strings"
"testing" "testing"
"time" "time"
@ -972,6 +973,12 @@ func TestPrecertOrphanQueue(t *testing.T) {
}) })
test.AssertError(t, err, "Expected IssuePrecertificate to fail with `failSA`") test.AssertError(t, err, "Expected IssuePrecertificate to fail with `failSA`")
matches := testCtx.logger.GetAllMatching(`orphaning precertificate.* regID=\[1\], orderID=\[1\]`)
if len(matches) != 1 {
t.Errorf("no log line, or incorrect log line for orphaned precertificate:\n%s",
strings.Join(testCtx.logger.GetAllMatching(".*"), "\n"))
}
qsa.fail = false qsa.fail = false
err = ca.integrateOrphan() err = ca.integrateOrphan()
test.AssertNotError(t, err, "integrateOrphan failed") test.AssertNotError(t, err, "integrateOrphan failed")