OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/policy/network_configuration_updater_impl_cros
.h" | 5 #include "chrome/browser/chromeos/policy/network_configuration_updater_impl_cros
.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 << chromeos::onc::GetSourceAsString(onc_source) | 102 << chromeos::onc::GetSourceAsString(onc_source) |
103 << " is not a string value."; | 103 << " is not a string value."; |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 base::ListValue network_configs; | 107 base::ListValue network_configs; |
108 base::ListValue certificates; | 108 base::ListValue certificates; |
109 ParseAndValidateOncForImport( | 109 ParseAndValidateOncForImport( |
110 onc_blob, onc_source, "", &network_configs, &certificates); | 110 onc_blob, onc_source, "", &network_configs, &certificates); |
111 | 111 |
112 network_library_->LoadOncNetworks(network_configs, onc_source); | 112 chromeos::CertificateHandler::CertsByGUID imported_server_and_ca_certs; |
113 | |
114 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); | 113 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); |
115 certificate_handler_->ImportCertificates( | 114 certificate_handler_->ImportCertificates( |
116 certificates, onc_source, web_trust_certs.get()); | 115 certificates, onc_source, web_trust_certs.get(), |
| 116 &imported_server_and_ca_certs); |
| 117 |
| 118 if (!chromeos::onc::ResolveServerCertRefsInNetworks( |
| 119 imported_server_and_ca_certs, &network_configs)) { |
| 120 LOG(ERROR) << "Some certificate references in the ONC policy for source " |
| 121 << chromeos::onc::GetSourceAsString(onc_source) |
| 122 << " could not be resolved."; |
| 123 } |
| 124 |
| 125 net::CertificateList imported_server_and_ca_certs_list; |
| 126 for (chromeos::CertificateHandler::CertsByGUID::iterator it = |
| 127 imported_server_and_ca_certs.begin(); |
| 128 it != imported_server_and_ca_certs.end(); ++it) { |
| 129 imported_server_and_ca_certs_list.push_back(it->second); |
| 130 } |
| 131 network_library_->LoadOncNetworks( |
| 132 network_configs, |
| 133 onc_source, |
| 134 base::Bind(&chromeos::onc::GetPEMEncodedCertFromFingerprint, |
| 135 imported_server_and_ca_certs_list)); |
117 | 136 |
118 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) | 137 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) |
119 SetTrustAnchors(web_trust_certs.Pass()); | 138 SetTrustAnchors(web_trust_certs.Pass()); |
120 } | 139 } |
121 | 140 |
122 } // namespace policy | 141 } // namespace policy |
OLD | NEW |