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

Unified Diff: chrome/browser/policy/configuration_policy_handler_chromeos.cc

Issue 11415148: Adding error handling to ONC validation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@extract_onc_certificate
Patch Set: Initial patch. Created 8 years, 1 month 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: chrome/browser/policy/configuration_policy_handler_chromeos.cc
diff --git a/chrome/browser/policy/configuration_policy_handler_chromeos.cc b/chrome/browser/policy/configuration_policy_handler_chromeos.cc
index 4f72026934de99a877293b61a0a8d546edd6669f..9a2b7a4ecdc3d1cbfb2f15aea69cfdee86d653d8 100644
--- a/chrome/browser/policy/configuration_policy_handler_chromeos.cc
+++ b/chrome/browser/policy/configuration_policy_handler_chromeos.cc
@@ -53,7 +53,7 @@ bool NetworkConfigurationPolicyHandler::CheckPolicySettings(
scoped_ptr<base::DictionaryValue> root_dict =
onc::ReadDictionaryFromJson(onc_blob, &json_error);
if (root_dict.get() == NULL) {
- errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_PARSE_ERROR,
+ errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_PARSE_FAILED,
json_error);
return false;
}
@@ -66,12 +66,15 @@ bool NetworkConfigurationPolicyHandler::CheckPolicySettings(
true); // Validate for managed ONC
// ONC policies are always unencrypted.
+ std::string messages;
root_dict = validator.ValidateAndRepairObject(
- &onc::kUnencryptedConfigurationSignature,
- *root_dict);
+ &onc::kToplevelConfigurationSignature, *root_dict, &messages);
+ if (!messages.empty()) {
+ errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_PARSE_ERROR,
+ messages);
Mattias Nissler (ping if slow) 2012/11/29 12:49:24 It seems weird that instead of adding individual e
pneubeck (no reviews) 2012/11/29 12:58:02 What for? I could imagine, that having a list of e
Mattias Nissler (ping if slow) 2012/11/29 13:09:18 Right, now what if you want to format this in HTML
+ }
if (root_dict.get() == NULL) {
- errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_PARSE_ERROR);
// Don't reject the policy, as some networks or certificates could still
// be applied.
return true;

Powered by Google App Engine
This is Rietveld 408576698