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

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

Issue 11578005: Rejecting networks/certificates independently on ONC import and policy loading. (Closed) Base URL: http://git.chromium.org/chromium/src.git@reject_network_independently
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 | « chrome/browser/ui/webui/net_internals/net_internals_ui.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_certificate_importer.cc
diff --git a/chromeos/network/onc/onc_certificate_importer.cc b/chromeos/network/onc/onc_certificate_importer.cc
index b8d47111ed4832e560b40f3d3ffeedc80ba9abf9..e1ae94bbbabdbad3433edd3d27160c78eeef98fc 100644
--- a/chromeos/network/onc/onc_certificate_importer.cc
+++ b/chromeos/network/onc/onc_certificate_importer.cc
@@ -43,25 +43,31 @@ CertificateImporter::CertificateImporter(
CertificateImporter::ParseResult CertificateImporter::ParseAndStoreCertificates(
const base::ListValue& certificates) {
+ size_t successful_imports = 0;
for (size_t i = 0; i < certificates.GetSize(); ++i) {
const base::DictionaryValue* certificate = NULL;
if (!certificates.GetDictionary(i, &certificate)) {
ONC_LOG_ERROR("Certificate data malformed");
- return i > 0 ? IMPORT_INCOMPLETE : IMPORT_FAILED;
+ continue;
}
- if (VLOG_IS_ON(2))
- VLOG(2) << "Parsing certificate at index " << i << ": " << *certificate;
+ VLOG(2) << "Parsing certificate at index " << i << ": " << *certificate;
if (!ParseAndStoreCertificate(*certificate)) {
ONC_LOG_ERROR(
base::StringPrintf("Cannot parse certificate at index %zu", i));
- return i > 0 ? IMPORT_INCOMPLETE : IMPORT_FAILED;
+ } else {
+ VLOG(2) << "Successfully imported certificate at index " << i;
+ ++successful_imports;
}
-
- VLOG(2) << "Successfully imported certificate at index " << i;
}
- return IMPORT_OK;
+
+ if (successful_imports == certificates.GetSize())
+ return IMPORT_OK;
+ else if (successful_imports == 0)
+ return IMPORT_FAILED;
+ else
+ return IMPORT_INCOMPLETE;
}
bool CertificateImporter::ParseAndStoreCertificate(
@@ -76,7 +82,7 @@ bool CertificateImporter::ParseAndStoreCertificate(
bool remove = false;
if (certificate.GetBoolean(kRemove, &remove) && remove) {
if (!DeleteCertAndKeyByNickname(guid)) {
- ONC_LOG_WARNING("Unable to delete certificate");
+ ONC_LOG_ERROR("Unable to delete certificate");
return false;
} else {
return true;
« no previous file with comments | « chrome/browser/ui/webui/net_internals/net_internals_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698