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

Side by Side Diff: chromeos/network/onc/onc_validator.cc

Issue 1431563005: Handle prohibited technologies in device policy ONC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 "chromeos/network/onc/onc_validator.h" 5 #include "chromeos/network/onc/onc_validator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 base::DictionaryValue* result) { 882 base::DictionaryValue* result) {
883 using namespace ::onc::global_network_config; 883 using namespace ::onc::global_network_config;
884 using namespace ::onc::network_config; 884 using namespace ::onc::network_config;
885 885
886 // Validate kDisableNetworkTypes field. 886 // Validate kDisableNetworkTypes field.
887 const base::ListValue* disabled_network_types = NULL; 887 const base::ListValue* disabled_network_types = NULL;
888 if (result->GetListWithoutPathExpansion(kDisableNetworkTypes, 888 if (result->GetListWithoutPathExpansion(kDisableNetworkTypes,
889 &disabled_network_types)) { 889 &disabled_network_types)) {
890 // The kDisableNetworkTypes field is only allowed in user policy. 890 // The kDisableNetworkTypes field is only allowed in user policy.
891 if (!disabled_network_types->empty() && 891 if (!disabled_network_types->empty() &&
892 onc_source_ != ::onc::ONC_SOURCE_USER_POLICY) { 892 onc_source_ != ::onc::ONC_SOURCE_DEVICE_POLICY) {
893 error_or_warning_found_ = true; 893 error_or_warning_found_ = true;
894 LOG(ERROR) << "Disabled network types only allowed in user policy."; 894 LOG(ERROR) << "Disabled network types only allowed in device policy.";
895 return false; 895 return false;
896 } 896 }
897 } 897 }
898 898
899 // Ensure the list contains only legitimate network type identifiers. 899 // Ensure the list contains only legitimate network type identifiers.
900 const char* const kValidNetworkTypeValues[] = {kCellular, kEthernet, kWiFi, 900 const char* const kValidNetworkTypeValues[] = {kCellular, kEthernet, kWiFi,
901 kWimax}; 901 kWimax};
902 const std::vector<const char*> valid_network_type_values( 902 const std::vector<const char*> valid_network_type_values(
903 toVector(kValidNetworkTypeValues)); 903 toVector(kValidNetworkTypeValues));
904 if (!ListFieldContainsValidValues(*result, kDisableNetworkTypes, 904 if (!ListFieldContainsValidValues(*result, kDisableNetworkTypes,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 } 1016 }
1017 1017
1018 std::string Validator::MessageHeader() { 1018 std::string Validator::MessageHeader() {
1019 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, "."); 1019 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, ".");
1020 std::string message = "At " + path + ": "; 1020 std::string message = "At " + path + ": ";
1021 return message; 1021 return message;
1022 } 1022 }
1023 1023
1024 } // namespace onc 1024 } // namespace onc
1025 } // namespace chromeos 1025 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698