Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: net/cert/test_root_certs_mac.cc

Issue 14492003: Work around GTE CyberTrust/Baltimore CyberTrust cross-signing issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/test_root_certs.h ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/test_root_certs_mac.cc
diff --git a/net/cert/test_root_certs_mac.cc b/net/cert/test_root_certs_mac.cc
index 2728248d6dc7aceb3d981dbc0a0b414c6e8bd4e6..50c4b80a52b2d20ec21018c9f63e2d89e0b961c2 100644
--- a/net/cert/test_root_certs_mac.cc
+++ b/net/cert/test_root_certs_mac.cc
@@ -77,12 +77,18 @@ OSStatus TestRootCerts::FixupSecTrustRef(SecTrustRef trust_ref) const {
temporary_roots_);
if (status)
return status;
- // Trust system store in addition to trusting |temporary_roots_|.
- return SecTrustSetAnchorCertificatesOnly(trust_ref, false);
+ return SecTrustSetAnchorCertificatesOnly(trust_ref, !allow_system_trust_);
}
- // For OS X 10.6, emulate the functionality by copying the system roots
- // in addition to |temporary_roots_|.
+ if (!allow_system_trust_) {
+ // Avoid any copying if system roots are not to be trusted. This acts as
+ // an exclusive list on 10.6, replacing the built-ins.
+ return SecTrustSetAnchorCertificates(trust_ref, temporary_roots_);
+ }
+
+ // Otherwise, both system trust and temporary_roots_ must be trusted.
+ // Emulate the functionality of SecTrustSetAnchorCertificatesOnly by
+ // creating a copy of the system roots and merging with temporary_roots_.
CFArrayRef system_roots = NULL;
OSStatus status = SecTrustCopyAnchorCertificates(&system_roots);
if (status)
@@ -96,11 +102,16 @@ OSStatus TestRootCerts::FixupSecTrustRef(SecTrustRef trust_ref) const {
return SecTrustSetAnchorCertificates(trust_ref, scoped_roots);
}
+void TestRootCerts::SetAllowSystemTrust(bool allow_system_trust) {
+ allow_system_trust_ = allow_system_trust;
+}
+
TestRootCerts::~TestRootCerts() {}
void TestRootCerts::Init() {
temporary_roots_.reset(CFArrayCreateMutable(kCFAllocatorDefault, 0,
&kCertArrayCallbacks));
+ allow_system_trust_ = true;
}
} // namespace net
« no previous file with comments | « net/cert/test_root_certs.h ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698