From e9f91e3daabe307e9a65aceca1fda497ffdd69bd Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Mon, 23 Sep 2019 09:39:38 -0700 Subject: [PATCH] CA: Deref regID and orderID in orphaned precert log (#4443) --- ca/ca.go | 2 +- ca/ca_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ca/ca.go b/ca/ca.go index e4f1bc216..32d7da9cf 100644 --- a/ca/ca.go +++ b/ca/ca.go @@ -471,7 +471,7 @@ func (ca *CertificateAuthorityImpl) IssuePrecertificate(ctx context.Context, iss if err != nil { 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]", - serialHex, hex.EncodeToString(precertDER), err, issueReq.RegistrationID, issueReq.OrderID) + serialHex, hex.EncodeToString(precertDER), err, *issueReq.RegistrationID, *issueReq.OrderID) if ca.orphanQueue != nil { ca.queueOrphan(&orphanedCert{ DER: precertDER, diff --git a/ca/ca_test.go b/ca/ca_test.go index c807e5195..7df637dc4 100644 --- a/ca/ca_test.go +++ b/ca/ca_test.go @@ -15,6 +15,7 @@ import ( "math/big" "os" "sort" + "strings" "testing" "time" @@ -972,6 +973,12 @@ func TestPrecertOrphanQueue(t *testing.T) { }) 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 err = ca.integrateOrphan() test.AssertNotError(t, err, "integrateOrphan failed")