PKGBUILDs/core/nss/nss-3.47-certdb-temp-cert.patch

69 lines
2.6 KiB
Diff
Raw Normal View History

2019-12-07 00:23:10 +00:00
From 9530978d1552674792e281391100269305a38c47 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <dueno@redhat.com>
Date: Fri, 6 Dec 2019 10:47:01 +0100
Subject: [PATCH] Bug 1593167, certdb: propagate trust information if trust
module is loaded afterwards, r=rrelyea,keeler
2019-12-04 05:51:02 +00:00
Summary:
2019-12-04 19:22:47 +00:00
When the builtin trust module is loaded after some temp certs being created, these temp certs are usually not accompanied by trust information. This causes a problem in Firefox as it loads the module from a separate thread while accessing the network cache which populates temp certs.
2019-12-04 05:51:02 +00:00
2019-12-04 19:22:47 +00:00
This change makes it properly roll up the trust information, if a temp cert doesn't have trust information.
2019-12-04 05:51:02 +00:00
Reviewers: rrelyea, keeler
2019-12-07 00:23:10 +00:00
Reviewed By: rrelyea, keeler
2019-12-04 05:51:02 +00:00
Subscribers: reviewbot, heftig
Bug #: 1593167
Differential Revision: https://phabricator.services.mozilla.com/D54726
2019-12-07 00:23:10 +00:00
---
lib/pki/pki3hack.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
2019-12-04 05:51:02 +00:00
diff --git a/lib/pki/pki3hack.c b/lib/pki/pki3hack.c
2019-12-07 00:23:10 +00:00
index 29d2fb5a40..eac4a5705e 100644
2019-12-04 05:51:02 +00:00
--- a/lib/pki/pki3hack.c
+++ b/lib/pki/pki3hack.c
2019-12-07 00:23:10 +00:00
@@ -921,14 +921,28 @@ stan_GetCERTCertificate(NSSCertificate *c, PRBool forceUpdate)
2019-12-04 05:51:02 +00:00
}
if (!cc->nssCertificate || forceUpdate) {
fill_CERTCertificateFields(c, cc, forceUpdate);
- } else if (CERT_GetCertTrust(cc, &certTrust) != SECSuccess &&
- !c->object.cryptoContext) {
- /* if it's a perm cert, it might have been stored before the
- * trust, so look for the trust again. But a temp cert can be
- * ignored.
- */
- CERTCertTrust *trust = NULL;
- trust = nssTrust_GetCERTCertTrustForCert(c, cc);
+ } else if (CERT_GetCertTrust(cc, &certTrust) != SECSuccess) {
+ CERTCertTrust *trust;
+ if (!c->object.cryptoContext) {
+ /* If it's a perm cert, it might have been stored before the
+ * trust, so look for the trust again.
+ */
+ trust = nssTrust_GetCERTCertTrustForCert(c, cc);
+ } else {
2019-12-04 19:22:47 +00:00
+ /* If it's a temp cert, it might have been stored before the
+ * builtin trust module is loaded, so look for the trust
+ * again, but don't set the empty trust if it is not found.
2019-12-04 05:51:02 +00:00
+ */
+ NSSTrust *t = nssTrustDomain_FindTrustForCertificate(c->object.cryptoContext->td, c);
+ if (!t) {
+ goto loser;
+ }
+ trust = cert_trust_from_stan_trust(t, cc->arena);
2019-12-04 19:22:47 +00:00
+ nssTrust_Destroy(t);
+ if (!trust) {
+ goto loser;
+ }
2019-12-04 05:51:02 +00:00
+ }
CERT_LockCertTrust(cc);
cc->trust = trust;
2019-12-07 00:23:10 +00:00
--
2.24.0