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

Side by Side Diff: chrome/browser/chromeos/cros/network_library_impl_base.cc

Issue 13532005: Added a PolicyCertVerifier that uses the trust anchors from the ONC policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: skip tests when NSS version is too old Created 7 years, 8 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/cros/network_library_impl_base.h" 5 #include "chrome/browser/chromeos/cros/network_library_impl_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 else if (placeholder == onc::substitutes::kEmailField) 1057 else if (placeholder == onc::substitutes::kEmailField)
1058 *substitute = logged_in_user->email(); 1058 *substitute = logged_in_user->email();
1059 else 1059 else
1060 return false; 1060 return false;
1061 return true; 1061 return true;
1062 } 1062 }
1063 }; 1063 };
1064 1064
1065 } // namespace 1065 } // namespace
1066 1066
1067 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, 1067 bool NetworkLibraryImplBase::LoadOncNetworks(
1068 const std::string& passphrase, 1068 const std::string& onc_blob,
1069 onc::ONCSource source, 1069 const std::string& passphrase,
1070 bool allow_web_trust_from_policy) { 1070 onc::ONCSource source,
1071 net::CertificateList* onc_trusted_certificates) {
1071 VLOG(2) << __func__ << ": called on " << onc_blob; 1072 VLOG(2) << __func__ << ": called on " << onc_blob;
1072 NetworkProfile* profile = NULL; 1073 NetworkProfile* profile = NULL;
1073 bool from_policy = (source == onc::ONC_SOURCE_USER_POLICY || 1074 bool from_policy = (source == onc::ONC_SOURCE_USER_POLICY ||
1074 source == onc::ONC_SOURCE_DEVICE_POLICY); 1075 source == onc::ONC_SOURCE_DEVICE_POLICY);
1075 1076
1076 // Policies are applied to a specific Shill profile. User ONC import however 1077 // Policies are applied to a specific Shill profile. User ONC import however
1077 // is applied to whatever profile Shill chooses. This should be the profile 1078 // is applied to whatever profile Shill chooses. This should be the profile
1078 // that is already associated with a network and if no profile is associated 1079 // that is already associated with a network and if no profile is associated
1079 // yet, it should be the user profile. 1080 // yet, it should be the user profile.
1080 if (from_policy) { 1081 if (from_policy) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 &certificates); 1146 &certificates);
1146 1147
1147 const base::ListValue* network_configs; 1148 const base::ListValue* network_configs;
1148 bool has_network_configurations = root_dict->GetListWithoutPathExpansion( 1149 bool has_network_configurations = root_dict->GetListWithoutPathExpansion(
1149 onc::toplevel_config::kNetworkConfigurations, 1150 onc::toplevel_config::kNetworkConfigurations,
1150 &network_configs); 1151 &network_configs);
1151 1152
1152 if (has_certificates) { 1153 if (has_certificates) {
1153 VLOG(2) << "ONC file has " << certificates->GetSize() << " certificates"; 1154 VLOG(2) << "ONC file has " << certificates->GetSize() << " certificates";
1154 1155
1155 // Web trust is only granted to certificates imported for a managed user 1156 // Web trust is only granted to certificates imported by the user.
1156 // on a managed device and for user imports. 1157 bool allow_trust_imports = source == onc::ONC_SOURCE_USER_IMPORT;
1157 bool allow_web_trust = 1158 onc::CertificateImporter cert_importer(allow_trust_imports);
1158 (source == onc::ONC_SOURCE_USER_IMPORT) || 1159 if (cert_importer.ParseAndStoreCertificates(
1159 (source == onc::ONC_SOURCE_USER_POLICY && allow_web_trust_from_policy); 1160 *certificates, onc_trusted_certificates) !=
1160 onc::CertificateImporter cert_importer(allow_web_trust);
1161 if (cert_importer.ParseAndStoreCertificates(*certificates) !=
1162 onc::CertificateImporter::IMPORT_OK) { 1161 onc::CertificateImporter::IMPORT_OK) {
1163 LOG(ERROR) << "Cannot parse some of the certificates in the ONC from " 1162 LOG(ERROR) << "Cannot parse some of the certificates in the ONC from "
1164 << onc::GetSourceAsString(source); 1163 << onc::GetSourceAsString(source);
1165 success = false; 1164 success = false;
1166 } 1165 }
1167 } 1166 }
1168 1167
1169 std::set<std::string> removal_ids; 1168 std::set<std::string> removal_ids;
1170 std::set<std::string>& network_ids(network_source_map_[source]); 1169 std::set<std::string>& network_ids(network_source_map_[source]);
1171 network_ids.clear(); 1170 network_ids.clear();
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 GetTpmInfo(); 1798 GetTpmInfo();
1800 return tpm_slot_; 1799 return tpm_slot_;
1801 } 1800 }
1802 1801
1803 const std::string& NetworkLibraryImplBase::GetTpmPin() { 1802 const std::string& NetworkLibraryImplBase::GetTpmPin() {
1804 GetTpmInfo(); 1803 GetTpmInfo();
1805 return tpm_pin_; 1804 return tpm_pin_;
1806 } 1805 }
1807 1806
1808 } // namespace chromeos 1807 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698