Chromium Code Reviews| Index: chromeos/network/onc/onc_validator.cc |
| diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc |
| index 675539041d4300d0e5299e922f9d028671e6c8bd..06ab6dd8ee967a9272885a7747297b2692227dd5 100644 |
| --- a/chromeos/network/onc/onc_validator.cc |
| +++ b/chromeos/network/onc/onc_validator.cc |
| @@ -387,6 +387,20 @@ bool Validator::RequireField(const base::DictionaryValue& dict, |
| return false; |
| } |
| +bool Validator::VerifyGuidUniqueAndAddToHash(const base::DictionaryValue& dict, |
| + const std::string& key_guid, |
| + std::set<std::string> *guids) { |
| + std::string guid; |
| + if (dict.GetStringWithoutPathExpansion(key_guid, &guid)) { |
| + if (guids->count(guid) != 0) { |
| + error_or_warning_found_ = true; |
|
pneubeck (no reviews)
2014/02/17 10:11:36
Log an error (it's always an error and not a warni
kaliamoorthi
2014/02/17 15:06:49
Done.
|
| + return false; |
| + } |
| + guids->insert(guid); |
| + } |
| + return true; |
| +} |
| + |
| bool Validator::IsCertPatternInDevicePolicy(const std::string& cert_type) { |
| if (cert_type == ::onc::certificate::kPattern && |
| onc_source_ == ::onc::ONC_SOURCE_DEVICE_POLICY) { |
| @@ -458,6 +472,9 @@ bool Validator::ValidateNetworkConfiguration(base::DictionaryValue* result) { |
| return false; |
| } |
| + if (!VerifyGuidUniqueAndAddToHash(*result, kGUID, &network_guids_)) |
| + return false; |
| + |
| bool all_required_exist = RequireField(*result, kGUID); |
| bool remove = false; |
| @@ -812,6 +829,9 @@ bool Validator::ValidateCertificate(base::DictionaryValue* result) { |
| return false; |
| } |
| + if (!VerifyGuidUniqueAndAddToHash(*result, kGUID, &certificate_guids_)) |
| + return false; |
| + |
| bool all_required_exist = RequireField(*result, kGUID); |
| bool remove = false; |