Closed Bug 1608745 Opened 5 years ago Closed 5 years ago

Repetitive code in ProcessCrlDistPoints

Categories

(Core :: Security: PSM, task)

74 Branch
task
Not set
normal

Tracking

()

RESOLVED WONTFIX
Tracking Status
firefox74 --- wontfix

People

(Reporter: alexhenrie24, Assigned: alexhenrie24)

Details

Attachments

(1 file)

Since before the switch to Mercurial in 2007, ProcessCrlDistPoints has had (with minor changes) the following lengthy and repetitive chunk of code:

  bool comma = false;
  if (reasons & RF_UNUSED) {
    GetPIPNSSBundleString("CertDumpUnused", local);
    text.Append(local);
    comma = true;
  }
  if (reasons & RF_KEY_COMPROMISE) {
    if (comma) text.AppendLiteral(", ");
    GetPIPNSSBundleString("CertDumpKeyCompromise", local);
    text.Append(local);
    comma = true;
  }
  if (reasons & RF_CA_COMPROMISE) {
    if (comma) text.AppendLiteral(", ");
    GetPIPNSSBundleString("CertDumpCACompromise", local);
    text.Append(local);
    comma = true;
  }
  if (reasons & RF_AFFILIATION_CHANGED) {
    if (comma) text.AppendLiteral(", ");
    GetPIPNSSBundleString("CertDumpAffiliationChanged", local);
    text.Append(local);
    comma = true;
  }
  if (reasons & RF_SUPERSEDED) {
    if (comma) text.AppendLiteral(", ");
    GetPIPNSSBundleString("CertDumpSuperseded", local);
    text.Append(local);
    comma = true;
  }
  if (reasons & RF_CESSATION_OF_OPERATION) {
    if (comma) text.AppendLiteral(", ");
    GetPIPNSSBundleString("CertDumpCessation", local);
    text.Append(local);
    comma = true;
  }
  if (reasons & RF_CERTIFICATE_HOLD) {
    if (comma) text.AppendLiteral(", ");
    GetPIPNSSBundleString("CertDumpHold", local);
    text.Append(local);
    comma = true;
  }

This should all be replaced with a loop to improve code readability and performance, and to make refactoring it easier in the future.

Assignee: nobody → alexhenrie24
Status: NEW → ASSIGNED
Component: Security → Security: PSM
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: