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

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: Rebased. 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
Index: chromeos/network/onc/onc_validator.cc
diff --git a/chromeos/network/onc/onc_validator.cc b/chromeos/network/onc/onc_validator.cc
index cb320970521437e9babba2e5add883260db60723..bba2d904faace43c606013f8ca09e383bfe68a2d 100644
--- a/chromeos/network/onc/onc_validator.cc
+++ b/chromeos/network/onc/onc_validator.cc
@@ -177,6 +177,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,
@@ -229,6 +247,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;

Powered by Google App Engine
This is Rietveld 408576698