| 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 "chromeos/network/onc/onc_validator.h" | 5 #include "chromeos/network/onc/onc_validator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 | 966 |
| 967 const char* const kValidTypes[] = {kClient, kServer, kAuthority}; | 967 const char* const kValidTypes[] = {kClient, kServer, kAuthority}; |
| 968 const std::vector<const char*> valid_types(toVector(kValidTypes)); | 968 const std::vector<const char*> valid_types(toVector(kValidTypes)); |
| 969 if (FieldExistsAndHasNoValidValue(*result, kType, valid_types) || | 969 if (FieldExistsAndHasNoValidValue(*result, kType, valid_types) || |
| 970 FieldExistsAndIsEmpty(*result, kGUID)) { | 970 FieldExistsAndIsEmpty(*result, kGUID)) { |
| 971 return false; | 971 return false; |
| 972 } | 972 } |
| 973 | 973 |
| 974 std::string type; | 974 std::string type; |
| 975 result->GetStringWithoutPathExpansion(kType, &type); | 975 result->GetStringWithoutPathExpansion(kType, &type); |
| 976 if (onc_source_ == ::onc::ONC_SOURCE_DEVICE_POLICY && | |
| 977 (type == kServer || type == kAuthority)) { | |
| 978 error_or_warning_found_ = true; | |
| 979 LOG(ERROR) << MessageHeader() << "Server and authority certificates are " | |
| 980 << "prohibited in ONC device policies."; | |
| 981 return false; | |
| 982 } | |
| 983 | 976 |
| 984 if (!CheckGuidIsUniqueAndAddToSet(*result, kGUID, &certificate_guids_)) | 977 if (!CheckGuidIsUniqueAndAddToSet(*result, kGUID, &certificate_guids_)) |
| 985 return false; | 978 return false; |
| 986 | 979 |
| 987 bool all_required_exist = RequireField(*result, kGUID); | 980 bool all_required_exist = RequireField(*result, kGUID); |
| 988 | 981 |
| 989 bool remove = false; | 982 bool remove = false; |
| 990 result->GetBooleanWithoutPathExpansion(::onc::kRemove, &remove); | 983 result->GetBooleanWithoutPathExpansion(::onc::kRemove, &remove); |
| 991 if (remove) { | 984 if (remove) { |
| 992 error_or_warning_found_ = true; | 985 error_or_warning_found_ = true; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 } | 1036 } |
| 1044 | 1037 |
| 1045 std::string Validator::MessageHeader() { | 1038 std::string Validator::MessageHeader() { |
| 1046 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, "."); | 1039 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, "."); |
| 1047 std::string message = "At " + path + ": "; | 1040 std::string message = "At " + path + ": "; |
| 1048 return message; | 1041 return message; |
| 1049 } | 1042 } |
| 1050 | 1043 |
| 1051 } // namespace onc | 1044 } // namespace onc |
| 1052 } // namespace chromeos | 1045 } // namespace chromeos |
| OLD | NEW |