Skip to content

Commit

Permalink
fix: bug
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Nov 27, 2024
1 parent 33d5590 commit 7984f57
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions revocation/internal/crl/crl.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,20 @@ func validateCRL(crl *x509.RevocationList, issuer *x509.Certificate) error {
}

// checkRevocation checks if the certificate is revoked or not
func checkRevocation(cert *x509.Certificate, bundle *crl.Bundle, signingTime time.Time, crlURL string) (*result.ServerResult, error) {
func checkRevocation(cert *x509.Certificate, b *crl.Bundle, signingTime time.Time, crlURL string) (*result.ServerResult, error) {
if cert == nil {
return nil, errors.New("certificate cannot be nil")
}
if bundle == nil {
if b == nil {
return nil, errors.New("CRL bundle cannot be nil")
}

Check warning on line 267 in revocation/internal/crl/crl.go

View check run for this annotation

Codecov / codecov/patch

revocation/internal/crl/crl.go#L266-L267

Added lines #L266 - L267 were not covered by tests
baseCRL := bundle.BaseCRL
if baseCRL == nil {
if b.BaseCRL == nil {
return nil, errors.New("baseCRL cannot be nil")
}

deltaCRL := bundle.DeltaCRL
entriesArray := []*[]x509.RevocationListEntry{&baseCRL.RevokedCertificateEntries}
if deltaCRL != nil {
entriesArray = append(entriesArray, &deltaCRL.RevokedCertificateEntries)
entriesArray := []*[]x509.RevocationListEntry{&b.BaseCRL.RevokedCertificateEntries}
if b.DeltaCRL != nil {
entriesArray = append(entriesArray, &b.DeltaCRL.RevokedCertificateEntries)
}

Check warning on line 275 in revocation/internal/crl/crl.go

View check run for this annotation

Codecov / codecov/patch

revocation/internal/crl/crl.go#L274-L275

Added lines #L274 - L275 were not covered by tests

// latestTempRevokedEntry contains the most recent revocation entry with
Expand Down Expand Up @@ -306,7 +304,7 @@ func checkRevocation(cert *x509.Certificate, bundle *crl.Bundle, signingTime tim
// temporarily revoked or unrevoked
if latestTempRevokedEntry == nil || latestTempRevokedEntry.RevocationTime.Before(revocationEntry.RevocationTime) {
// the revocation status depends on the most recent reason
latestTempRevokedEntry = &baseCRL.RevokedCertificateEntries[i]
latestTempRevokedEntry = &(*entries)[i]
}

Check warning on line 308 in revocation/internal/crl/crl.go

View check run for this annotation

Codecov / codecov/patch

revocation/internal/crl/crl.go#L303-L308

Added lines #L303 - L308 were not covered by tests
default:
// permanently revoked
Expand Down

0 comments on commit 7984f57

Please sign in to comment.