| 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 <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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 | 873 |
| 874 bool all_required_exist = | 874 bool all_required_exist = |
| 875 RequireField(*result, kHost) && RequireField(*result, kPort); | 875 RequireField(*result, kHost) && RequireField(*result, kPort); |
| 876 | 876 |
| 877 return !error_on_missing_field_ || all_required_exist; | 877 return !error_on_missing_field_ || all_required_exist; |
| 878 } | 878 } |
| 879 | 879 |
| 880 bool Validator::ValidateEAP(base::DictionaryValue* result) { | 880 bool Validator::ValidateEAP(base::DictionaryValue* result) { |
| 881 using namespace ::onc::eap; | 881 using namespace ::onc::eap; |
| 882 | 882 |
| 883 const char* const kValidInnerValues[] = {kAutomatic, kMD5, kMSCHAPv2, kPAP}; | 883 const char* const kValidInnerValues[] = { |
| 884 kAutomatic, kGTC, kMD5, kMSCHAPv2, kPAP}; |
| 884 const std::vector<const char*> valid_inner_values( | 885 const std::vector<const char*> valid_inner_values( |
| 885 toVector(kValidInnerValues)); | 886 toVector(kValidInnerValues)); |
| 886 const char* const kValidOuterValues[] = { | 887 const char* const kValidOuterValues[] = { |
| 887 kPEAP, kEAP_TLS, kEAP_TTLS, kLEAP, kEAP_SIM, kEAP_FAST, kEAP_AKA}; | 888 kPEAP, kEAP_TLS, kEAP_TTLS, kLEAP, kEAP_SIM, kEAP_FAST, kEAP_AKA}; |
| 888 const std::vector<const char*> valid_outer_values( | 889 const std::vector<const char*> valid_outer_values( |
| 889 toVector(kValidOuterValues)); | 890 toVector(kValidOuterValues)); |
| 890 | 891 |
| 891 if (FieldExistsAndHasNoValidValue(*result, kInner, valid_inner_values) || | 892 if (FieldExistsAndHasNoValidValue(*result, kInner, valid_inner_values) || |
| 892 FieldExistsAndHasNoValidValue(*result, kOuter, valid_outer_values) || | 893 FieldExistsAndHasNoValidValue(*result, kOuter, valid_outer_values) || |
| 893 FieldExistsAndIsEmpty(*result, kServerCARefs)) { | 894 FieldExistsAndIsEmpty(*result, kServerCARefs)) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 } | 952 } |
| 952 | 953 |
| 953 std::string Validator::MessageHeader() { | 954 std::string Validator::MessageHeader() { |
| 954 std::string path = path_.empty() ? "toplevel" : JoinString(path_, "."); | 955 std::string path = path_.empty() ? "toplevel" : JoinString(path_, "."); |
| 955 std::string message = "At " + path + ": "; | 956 std::string message = "At " + path + ": "; |
| 956 return message; | 957 return message; |
| 957 } | 958 } |
| 958 | 959 |
| 959 } // namespace onc | 960 } // namespace onc |
| 960 } // namespace chromeos | 961 } // namespace chromeos |
| OLD | NEW |