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

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

Issue 193273002: Handle cases when user cert database has NULL slots (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 months 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/cert_loader_unittest.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_impl.cc
diff --git a/chromeos/network/onc/onc_certificate_importer_impl.cc b/chromeos/network/onc/onc_certificate_importer_impl.cc
index 5fbcfb1e0d0dbed6bd41685c0e9fa374955330ae..13e4880fe63602769ad8d62e0474bc791913754e 100644
--- a/chromeos/network/onc/onc_certificate_importer_impl.cc
+++ b/chromeos/network/onc/onc_certificate_importer_impl.cc
@@ -14,6 +14,7 @@
#include "chromeos/network/network_event_log.h"
#include "chromeos/network/onc/onc_utils.h"
#include "components/onc/onc_constants.h"
+#include "crypto/scoped_nss_types.h"
#include "net/base/crypto_module.h"
#include "net/base/net_errors.h"
#include "net/cert/nss_cert_database.h"
@@ -318,8 +319,11 @@ bool CertificateImporterImpl::ParseClientCertificate(
}
// Since this has a private key, always use the private module.
- scoped_refptr<net::CryptoModule> module(net::CryptoModule::CreateFromHandle(
- target_nssdb_->GetPrivateSlot().get()));
+ crypto::ScopedPK11Slot private_slot(target_nssdb_->GetPrivateSlot());
+ if (!private_slot)
+ return false;
+ scoped_refptr<net::CryptoModule> module(
+ net::CryptoModule::CreateFromHandle(private_slot.get()));
net::CertificateList imported_certs;
int import_result = target_nssdb_->ImportFromPKCS12(
« no previous file with comments | « chromeos/cert_loader_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698