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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 880
881 bool Validator::ValidateGlobalNetworkConfiguration( 881 bool Validator::ValidateGlobalNetworkConfiguration(
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 device 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 if (result->HasKey(kAllowOnlyPolicyNetworksToConnect)) { 899 if (result->HasKey(kAllowOnlyPolicyNetworksToConnect)) {
900 // The kAllowOnlyPolicyNetworksToConnect field is only allowed in device 900 // The kAllowOnlyPolicyNetworksToConnect field is only allowed in device
901 // policy. 901 // policy.
902 if (onc_source_ != ::onc::ONC_SOURCE_DEVICE_POLICY) { 902 if (onc_source_ != ::onc::ONC_SOURCE_DEVICE_POLICY) {
903 error_or_warning_found_ = true; 903 error_or_warning_found_ = true;
904 LOG(ERROR) 904 LOG(ERROR)
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 } 1027 }
1028 1028
1029 std::string Validator::MessageHeader() { 1029 std::string Validator::MessageHeader() {
1030 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, "."); 1030 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, ".");
1031 std::string message = "At " + path + ": "; 1031 std::string message = "At " + path + ": ";
1032 return message; 1032 return message;
1033 } 1033 }
1034 1034
1035 } // namespace onc 1035 } // namespace onc
1036 } // namespace chromeos 1036 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state_handler.cc ('k') | chromeos/network/onc/onc_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698