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> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 | 11 |
9 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 13 #include "base/logging.h" |
11 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
13 #include "base/values.h" | 16 #include "base/values.h" |
14 #include "chromeos/network/onc/onc_signature.h" | 17 #include "chromeos/network/onc/onc_signature.h" |
15 | 18 |
16 namespace chromeos { | 19 namespace chromeos { |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 } else { | 448 } else { |
446 LOG(ERROR) << msg; | 449 LOG(ERROR) << msg; |
447 return false; | 450 return false; |
448 } | 451 } |
449 } | 452 } |
450 | 453 |
451 // Check HexSSID validity. | 454 // Check HexSSID validity. |
452 std::string hex_ssid_string; | 455 std::string hex_ssid_string; |
453 if (object->GetStringWithoutPathExpansion(::onc::wifi::kHexSSID, | 456 if (object->GetStringWithoutPathExpansion(::onc::wifi::kHexSSID, |
454 &hex_ssid_string)) { | 457 &hex_ssid_string)) { |
455 std::vector<uint8> decoded_ssid; | 458 std::vector<uint8_t> decoded_ssid; |
456 if (!base::HexStringToBytes(hex_ssid_string, &decoded_ssid)) { | 459 if (!base::HexStringToBytes(hex_ssid_string, &decoded_ssid)) { |
457 LOG(ERROR) << MessageHeader() << "Field " << ::onc::wifi::kHexSSID | 460 LOG(ERROR) << MessageHeader() << "Field " << ::onc::wifi::kHexSSID |
458 << " is not a valid hex representation: \"" << hex_ssid_string | 461 << " is not a valid hex representation: \"" << hex_ssid_string |
459 << "\""; | 462 << "\""; |
460 error_or_warning_found_ = true; | 463 error_or_warning_found_ = true; |
461 return false; | 464 return false; |
462 } | 465 } |
463 if (decoded_ssid.size() <= 0 || | 466 if (decoded_ssid.size() <= 0 || |
464 decoded_ssid.size() > kMaximumSSIDLengthInBytes) { | 467 decoded_ssid.size() > kMaximumSSIDLengthInBytes) { |
465 LOG(ERROR) << MessageHeader() << ::onc::wifi::kHexSSID | 468 LOG(ERROR) << MessageHeader() << ::onc::wifi::kHexSSID |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 } | 1030 } |
1028 | 1031 |
1029 std::string Validator::MessageHeader() { | 1032 std::string Validator::MessageHeader() { |
1030 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, "."); | 1033 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, "."); |
1031 std::string message = "At " + path + ": "; | 1034 std::string message = "At " + path + ": "; |
1032 return message; | 1035 return message; |
1033 } | 1036 } |
1034 | 1037 |
1035 } // namespace onc | 1038 } // namespace onc |
1036 } // namespace chromeos | 1039 } // namespace chromeos |
OLD | NEW |