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/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 Loading... | |
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* web_trust_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 Loading... | |
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. |
Ryan Sleevi
2013/03/25 21:09:53
Same comments about "web trust"
Joao da Silva
2013/03/31 19:22:14
Renamed to "allow_trust_imports".
| |
1156 // on a managed device and for user imports. | 1157 bool allow_web_trust = source == onc::ONC_SOURCE_USER_IMPORT; |
1157 bool allow_web_trust = | |
1158 (source == onc::ONC_SOURCE_USER_IMPORT) || | |
1159 (source == onc::ONC_SOURCE_USER_POLICY && allow_web_trust_from_policy); | |
1160 onc::CertificateImporter cert_importer(allow_web_trust); | 1158 onc::CertificateImporter cert_importer(allow_web_trust); |
1161 if (cert_importer.ParseAndStoreCertificates(*certificates) != | 1159 if (cert_importer.ParseAndStoreCertificates( |
1160 *certificates, web_trust_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 Loading... | |
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 |
OLD | NEW |