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

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

Issue 16946002: Resolve certificate references in ONC by PEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a unit test for the resolve function. Created 7 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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.h" 5 #include "chrome/browser/chromeos/policy/network_configuration_updater_impl.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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } else { 90 } else {
91 VLOG(2) << "The policy is not set."; 91 VLOG(2) << "The policy is not set.";
92 } 92 }
93 VLOG(2) << "The policy contains this ONC: " << onc_blob; 93 VLOG(2) << "The policy contains this ONC: " << onc_blob;
94 94
95 base::ListValue network_configs; 95 base::ListValue network_configs;
96 base::ListValue certificates; 96 base::ListValue certificates;
97 ParseAndValidateOncForImport( 97 ParseAndValidateOncForImport(
98 onc_blob, onc_source, "", &network_configs, &certificates); 98 onc_blob, onc_source, "", &network_configs, &certificates);
99 99
100 chromeos::CertificateHandler::CertsByGUID imported_server_and_ca_certs;
101 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList);
102 certificate_handler_->ImportCertificates(
103 certificates, onc_source, web_trust_certs.get(),
104 &imported_server_and_ca_certs);
105
106 if (!chromeos::onc::ResolveServerCertRefsInNetworks(
107 imported_server_and_ca_certs, &network_configs)) {
108 LOG(ERROR) << "Some certificate references in the ONC policy for source "
109 << chromeos::onc::GetSourceAsString(onc_source)
110 << " could not be resolved.";
111 }
112
100 std::string userhash = onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY ? 113 std::string userhash = onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY ?
101 hashed_username_ : std::string(); 114 hashed_username_ : std::string();
102 chromeos::NetworkHandler::Get()->managed_network_configuration_handler()-> 115 chromeos::NetworkHandler::Get()->managed_network_configuration_handler()->
103 SetPolicy(onc_source, userhash, network_configs); 116 SetPolicy(onc_source, userhash, network_configs);
104 117
105 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList);
106 certificate_handler_->ImportCertificates(
107 certificates, onc_source, web_trust_certs.get());
108
109 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) 118 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY)
110 SetTrustAnchors(web_trust_certs.Pass()); 119 SetTrustAnchors(web_trust_certs.Pass());
111 } 120 }
112 121
113 } // namespace policy 122 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698