OLD | NEW |
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } else { | 85 } else { |
86 VLOG(2) << "The policy is not set."; | 86 VLOG(2) << "The policy is not set."; |
87 } | 87 } |
88 VLOG(2) << "The policy contains this ONC: " << onc_blob; | 88 VLOG(2) << "The policy contains this ONC: " << onc_blob; |
89 | 89 |
90 base::ListValue network_configs; | 90 base::ListValue network_configs; |
91 base::ListValue certificates; | 91 base::ListValue certificates; |
92 ParseAndValidateOncForImport( | 92 ParseAndValidateOncForImport( |
93 onc_blob, onc_source, "", &network_configs, &certificates); | 93 onc_blob, onc_source, "", &network_configs, &certificates); |
94 | 94 |
| 95 chromeos::CertificateHandler::CertsByGUID imported_server_and_ca_certs; |
| 96 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); |
| 97 certificate_handler_->ImportCertificates( |
| 98 certificates, onc_source, web_trust_certs.get(), |
| 99 &imported_server_and_ca_certs); |
| 100 |
| 101 if (!chromeos::onc::ResolveServerCertRefsInNetworks( |
| 102 imported_server_and_ca_certs, &network_configs)) { |
| 103 LOG(ERROR) << "Some certificate references in the ONC policy for source " |
| 104 << chromeos::onc::GetSourceAsString(onc_source) |
| 105 << " could not be resolved."; |
| 106 } |
| 107 |
95 std::string userhash = onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY ? | 108 std::string userhash = onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY ? |
96 hashed_username_ : std::string(); | 109 hashed_username_ : std::string(); |
97 chromeos::NetworkHandler::Get()->managed_network_configuration_handler()-> | 110 chromeos::NetworkHandler::Get()->managed_network_configuration_handler()-> |
98 SetPolicy(onc_source, userhash, network_configs); | 111 SetPolicy(onc_source, userhash, network_configs); |
99 | 112 |
100 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); | |
101 certificate_handler_->ImportCertificates( | |
102 certificates, onc_source, web_trust_certs.get()); | |
103 | |
104 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) | 113 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) |
105 SetTrustAnchors(web_trust_certs.Pass()); | 114 SetTrustAnchors(web_trust_certs.Pass()); |
106 } | 115 } |
107 | 116 |
108 } // namespace policy | 117 } // namespace policy |
OLD | NEW |