Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: chromeos/network/onc/onc_validator.cc

Issue 11428078: Rejecting networks/certificates individually from ONC during validation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@add_error_handling_to_validator
Patch Set: Addressed Steven's comment. Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/onc/onc_validator.h ('k') | chromeos/network/onc/onc_validator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_validator.cc
diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc
index 6b984fa2b27bfe10371126d1406a7bc81c8aa833..dedf0668466ba1cc340faef0ee0d7b3d8d8fe9ae 100644
--- a/chromeos/network/onc/onc_validator.cc
+++ b/chromeos/network/onc/onc_validator.cc
@@ -178,6 +178,24 @@ scoped_ptr<base::Value> Validator::MapField(
return result.Pass();
}
+scoped_ptr<base::ListValue> Validator::MapArray(
+ const OncValueSignature& array_signature,
+ const base::ListValue& onc_array,
+ bool* nested_error) {
+ bool nested_error_in_current_array = false;
+ scoped_ptr<base::ListValue> result = Mapper::MapArray(
+ array_signature, onc_array, &nested_error_in_current_array);
+
+ // Drop individual networks and certificates instead of rejecting all of
+ // the configuration.
+ if (nested_error_in_current_array &&
+ &array_signature != &kNetworkConfigurationListSignature &&
+ &array_signature != &kCertificateListSignature) {
+ *nested_error = nested_error_in_current_array;
+ }
+ return result.Pass();
+}
+
scoped_ptr<base::Value> Validator::MapEntry(int index,
const OncValueSignature& signature,
const base::Value& onc_value,
@@ -230,6 +248,7 @@ bool Validator::ValidateRecommendedField(
recommended.reset(recommended_list);
if (!managed_onc_) {
+ error_or_warning_found_ = true;
LOG(WARNING) << WarningHeader() << "Found the field '" << onc::kRecommended
<< "' in an unmanaged ONC. Removing it.";
return true;
« no previous file with comments | « chromeos/network/onc/onc_validator.h ('k') | chromeos/network/onc/onc_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698