Closed Bug 867437 Opened 11 years ago Closed 11 years ago

Remove calls to nsIX509Cert.verifyForUsage in mailnews

Categories

(MailNews Core :: Security: S/MIME, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 24.0

People

(Reporter: briansmith, Assigned: mkmelin)

References

Details

Attachments

(1 file)

Thunderbird has a few places that have this pattern:

   cert = certdb.FindCertByEmailAddress(...)
   cert.verifyForUsage(CERT_USAGE_EmailRecipient);

The call to verifyForUsage is unnecessary because FindCertByEmailAddress already verifies the cert is valid for CERT_USAGE_EmailRecipient:

    SECStatus srv = certVerifier->VerifyCert(node->cert,
                                             certificateUsageEmailRecipient,
                                             PR_Now(), nullptr /*XXX pinarg*/);

nsIX509Cert.verifyForUsage is being removed so these calls in Thunderbird need to be removed to avoid breaking Thunderbird's S/MIME support.

/mailnews/extensions/smime/src/nsMsgComposeSecure.cpp (View Hg log or Hg annotations)

    line 833 -- cert->VerifyForUsage(nsIX509Cert::CERT_USAGE_EmailRecipient, &verification_result))

/mailnews/extensions/smime/src/nsSMimeJSHelper.cpp (View Hg log or Hg annotations)

    line 132 -- cert->VerifyForUsage(nsIX509Cert::CERT_USAGE_EmailRecipient, &verification_result)))
    line 276 -- cert->VerifyForUsage(nsIX509Cert::CERT_USAGE_EmailRecipient, &verification_result))
The bug for the removal of nsIX509Cert.verifyForUsage is bug 867432.
See Also: → 867432
Summary: Remove calls to nsIX509Cert.verifyForUsage → Remove calls to nsIX509Cert.verifyForUsage in mailnews
Adding dep.
Depends on: 867432
Blocks: 867432
No longer depends on: 867432
Attached patch proposed fixSplinter Review
This removes it from the smime parts. 

I see testpilot got removed from firefox in bug 867445. We probably should too. Even if gets re-added it's probably just as easy to re-add as to port any changes they made. (We do seem to have the option to keep it, but scrub the verifyForUsage usage, per bug 867430)
Assignee: nobody → mkmelin+mozilla
Status: NEW → ASSIGNED
Attachment #763137 - Flags: review?(mbanner)
Attachment #763137 - Flags: feedback?
Attachment #763137 - Flags: feedback?
Depends on: 883629
Filed bug 883629 about test pilot removal.
Comment on attachment 763137 [details] [diff] [review]
proposed fix

Review of attachment 763137 [details] [diff] [review]:
-----------------------------------------------------------------

::: mailnews/extensions/smime/src/nsMsgComposeSecure.cpp
@@ +827,5 @@
> +                                           getter_AddRefs(cert));
> +      if (NS_FAILED(res)) {
> +        // Failure to find a valid encryption cert is fatal.
> +        // Here I assume that mailbox is ascii rather than utf8.
> +        SetErrorWithParam(sendReport, NS_LITERAL_STRING("MissingRecipientEncryptionCert").get(), mailbox);

Wrap this line at 80 characters.

@@ -850,5 @@
> -     if (...) no_clearsigning_p = true;
> -     (This is the only reason we even bother looking up the certs
> -     of the recipients if we're sending a signed-but-not-encrypted
> -     message.)
> -     */

I suggest that you leave this TODO comment in.
Attachment #763137 - Flags: feedback+
Comment on attachment 763137 [details] [diff] [review]
proposed fix

Review of attachment 763137 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the comments that Brian mentioned fix.
Attachment #763137 - Flags: review?(mbanner) → review+
I went ahead and pushed this to fix comm-central's being busted by bug 867432 landing on m-c. I did my best to address Brian's comments before pushing (re-adding the deleted comment and attempting to wrap at 80 characters), but I didn't see an obvious way to get one of the lines under 80.

https://hg.mozilla.org/comm-central/rev/faccb99fbc10
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 24.0
Depends on: 885292
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: