Skip to content

Commit

Permalink
Merge pull request stratisproject#220 from quantumagi/dltremredun
Browse files Browse the repository at this point in the history
Remove superfluous condition in IssueCertificate
  • Loading branch information
quantumagi authored Feb 27, 2020
2 parents 642027d + 49c09d7 commit 3dc1136
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/CertificateAuthority/CaCertificatesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private CertificateInfoModel IssueCertificate(Pkcs10CertificationRequest certReq
CertificateInfoModel existingCertificate = this.repository.GetCertificateIssuedByAccountId(cred);

// TODO: Should this actually throw instead?
if (existingCertificate != null && existingCertificate.Status != CertificateStatus.Revoked)
if (existingCertificate != null)
return existingCertificate;

string knownSubjectDistinguishedName = this.GetClientCertificateSubjectDistinguishedName(new CredentialsAccessModel(model.AccountId, model.Password, AccountAccessFlags.BasicAccess));
Expand Down Expand Up @@ -669,6 +669,10 @@ public bool RevokeCertificateForAccount(CredentialsAccessWithModel<CredentialsMo
{
CertificateInfoModel certificate = this.repository.GetCertificateIssuedByAccountId(model);

// TODO: Should this actually throw instead?
if (certificate == null)
return true;

this.repository.CertStatusesByThumbprint[certificate.Thumbprint] = CertificateStatus.Revoked;

CertificateInfoModel certToEdit = dbContext.Certificates.Single(x => x.Thumbprint == certificate.Thumbprint);
Expand Down

0 comments on commit 3dc1136

Please sign in to comment.