ra: remove special case for empty DNSNames (#7795)
This case was added to work around a test case that didn't fill it out; instead, fill DNSNames for that test case.
This commit is contained in:
parent
a79a830f3b
commit
1d8cf3e212
7
ra/ra.go
7
ra/ra.go
|
@ -1336,16 +1336,11 @@ func (ra *RegistrationAuthorityImpl) issueCertificateInner(
|
||||||
return nil, nil, wrapError(err, "getting SCTs")
|
return nil, nil, wrapError(err, "getting SCTs")
|
||||||
}
|
}
|
||||||
|
|
||||||
var isRenewal bool
|
|
||||||
if len(parsedPrecert.DNSNames) > 0 {
|
|
||||||
// This should never happen under normal operation, but it sometimes
|
|
||||||
// occurs under test.
|
|
||||||
exists, err := ra.SA.FQDNSetExists(ctx, &sapb.FQDNSetExistsRequest{DnsNames: parsedPrecert.DNSNames})
|
exists, err := ra.SA.FQDNSetExists(ctx, &sapb.FQDNSetExistsRequest{DnsNames: parsedPrecert.DNSNames})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, wrapError(err, "checking if certificate is a renewal")
|
return nil, nil, wrapError(err, "checking if certificate is a renewal")
|
||||||
}
|
}
|
||||||
isRenewal = exists.Exists
|
isRenewal := exists.Exists
|
||||||
}
|
|
||||||
|
|
||||||
cert, err := ra.CA.IssueCertificateForPrecertificate(ctx, &capb.IssueCertificateForPrecertificateRequest{
|
cert, err := ra.CA.IssueCertificateForPrecertificate(ctx, &capb.IssueCertificateForPrecertificateRequest{
|
||||||
DER: precert.DER,
|
DER: precert.DER,
|
||||||
|
|
|
@ -3755,15 +3755,20 @@ type mockCAFailCertForPrecert struct {
|
||||||
|
|
||||||
// IssuePrecertificate needs to be mocked for mockCAFailCertForPrecert's `IssueCertificateForPrecertificate` to get called.
|
// IssuePrecertificate needs to be mocked for mockCAFailCertForPrecert's `IssueCertificateForPrecertificate` to get called.
|
||||||
func (ca *mockCAFailCertForPrecert) IssuePrecertificate(
|
func (ca *mockCAFailCertForPrecert) IssuePrecertificate(
|
||||||
context.Context,
|
ctx context.Context,
|
||||||
*capb.IssueCertificateRequest,
|
req *capb.IssueCertificateRequest,
|
||||||
...grpc.CallOption) (*capb.IssuePrecertificateResponse, error) {
|
opts ...grpc.CallOption) (*capb.IssuePrecertificateResponse, error) {
|
||||||
k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
k, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
parsedCSR, err := x509.ParseCertificateRequest(req.Csr)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
tmpl := &ctx509.Certificate{
|
tmpl := &ctx509.Certificate{
|
||||||
SerialNumber: big.NewInt(1),
|
SerialNumber: big.NewInt(1),
|
||||||
|
DNSNames: parsedCSR.DNSNames,
|
||||||
ExtraExtensions: []ctpkix.Extension{
|
ExtraExtensions: []ctpkix.Extension{
|
||||||
{
|
{
|
||||||
Id: ctx509.OIDExtensionCTPoison,
|
Id: ctx509.OIDExtensionCTPoison,
|
||||||
|
|
Loading…
Reference in New Issue