diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 02:42:59 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 02:42:59 +0000 |
commit | eee2c0f944f3c374020dc247e893d5ef607f1b07 (patch) | |
tree | 2d535b293abc7d9715303ba41fc5bcb95b2924cf /net/third_party | |
parent | 6d2be86ff51c9efc990c4d5e43f972510dbe760c (diff) | |
download | chromium_src-eee2c0f944f3c374020dc247e893d5ef607f1b07.zip chromium_src-eee2c0f944f3c374020dc247e893d5ef607f1b07.tar.gz chromium_src-eee2c0f944f3c374020dc247e893d5ef607f1b07.tar.bz2 |
NSS cert database cleanups
Use ScopedPK11Slot.
Move common test functionality into functions.
Move common test conditions into SetUp/TearDown.
Move common test variables into attributes of the test class.
BUG=19991
TEST=tests still pass
Review URL: http://codereview.chromium.org/3189014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/third_party')
-rw-r--r-- | net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp index ab20b22..eac7ace 100644 --- a/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp +++ b/net/third_party/mozilla_security_manager/nsPKCS12Blob.cpp @@ -42,6 +42,7 @@ #include <p12plcy.h> #include <secerr.h> +#include "base/crypto/scoped_nss_types.h" #include "base/logging.h" #include "base/nss_util_internal.h" #include "base/string_util.h" @@ -260,14 +261,14 @@ void EnsurePKCS12Init() { int nsPKCS12Blob_Import(const char* pkcs12_data, size_t pkcs12_len, const string16& password) { - PK11SlotInfo *slot = base::GetDefaultNSSKeySlot(); - if (!slot) { + base::ScopedPK11Slot slot(base::GetDefaultNSSKeySlot()); + if (!slot.get()) { LOG(ERROR) << "Couldn't get Internal key slot!"; return net::ERR_PKCS12_IMPORT_FAILED; } int rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, false, - slot); + slot.get()); // When the user entered a zero length password: // An empty password should be represented as an empty @@ -278,10 +279,8 @@ int nsPKCS12Blob_Import(const char* pkcs12_data, // without giving a user prompt when trying the different empty password flavors. if (rv == net::ERR_PKCS12_IMPORT_BAD_PASSWORD && password.size() == 0) { rv = nsPKCS12Blob_ImportHelper(pkcs12_data, pkcs12_len, password, true, - slot); + slot.get()); } - - PK11_FreeSlot(slot); return rv; } |