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

Side by Side Diff: chrome/browser/chromeos/policy/network_configuration_updater_impl_cros.cc

Issue 16946002: Resolve certificate references in ONC by PEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, added function comments. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 << chromeos::onc::GetSourceAsString(onc_source) 158 << chromeos::onc::GetSourceAsString(onc_source)
159 << " is not a string value."; 159 << " is not a string value.";
160 } 160 }
161 } 161 }
162 162
163 base::ListValue network_configs; 163 base::ListValue network_configs;
164 base::ListValue certificates; 164 base::ListValue certificates;
165 ParseAndValidateOncForImport( 165 ParseAndValidateOncForImport(
166 onc_blob, onc_source, "", &network_configs, &certificates); 166 onc_blob, onc_source, "", &network_configs, &certificates);
167 167
168 network_library_->LoadOncNetworks(network_configs, onc_source); 168 chromeos::CertificateHandler::CertsByGUID imported_server_and_ca_certs;
169
170 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); 169 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList);
171 certificate_handler_->ImportCertificates( 170 certificate_handler_->ImportCertificates(
172 certificates, onc_source, web_trust_certs.get()); 171 certificates, onc_source, web_trust_certs.get(),
172 &imported_server_and_ca_certs);
173
174 if (!chromeos::onc::ResolveServerCertRefsInNetworks(
175 imported_server_and_ca_certs, &network_configs)) {
176 LOG(ERROR) << "Some certificate references in the ONC policy for source "
177 << chromeos::onc::GetSourceAsString(onc_source)
178 << " could not be resolved.";
179 }
180
181 net::CertificateList imported_server_and_ca_certs_list;
182 for (chromeos::CertificateHandler::CertsByGUID::iterator it =
183 imported_server_and_ca_certs.begin();
184 it != imported_server_and_ca_certs.end(); ++it) {
185 imported_server_and_ca_certs_list.push_back(it->second);
186 }
187 network_library_->LoadOncNetworks(
188 network_configs,
189 onc_source,
190 base::Bind(&chromeos::onc::GetPEMEncodedCertFromFingerprint,
191 imported_server_and_ca_certs_list));
stevenjb 2013/06/21 22:47:13 This feels awkward. Do we really need to abstract
pneubeck (no reviews) 2013/06/24 08:12:31 This way it's easier to test the Translator and Lo
stevenjb 2013/06/27 17:23:31 I looked at this more closely, and I still don't l
173 192
174 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) 193 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY)
175 SetTrustAnchors(web_trust_certs.Pass()); 194 SetTrustAnchors(web_trust_certs.Pass());
176 } 195 }
177 196
178 } // namespace policy 197 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698