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

Unified Diff: chrome/browser/importer/nss_decryptor.cc

Issue 160077: Linux: Fix NSSDecryptor to import Firefox passwords from the user database correctly. (Closed)
Patch Set: Add comments. Created 11 years, 5 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
Index: chrome/browser/importer/nss_decryptor.cc
diff --git a/chrome/browser/importer/nss_decryptor.cc b/chrome/browser/importer/nss_decryptor.cc
index 85c2ffcb28e79a06ecdb800852cd2db612187044..ccdd3ce3dfcd6dcb556f4de50b08de5e1b75ddf3 100644
--- a/chrome/browser/importer/nss_decryptor.cc
+++ b/chrome/browser/importer/nss_decryptor.cc
@@ -68,11 +68,10 @@ std::wstring NSSDecryptor::Decrypt(const std::string& crypt) const {
if (crypt[0] != '~') {
std::string decoded_data;
net::Base64Decode(crypt, &decoded_data);
- PK11SlotInfo* slot = NULL;
- slot = PK11_GetInternalKeySlot();
+ PK11SlotInfo* slot = GetKeySlotForDB();
SECStatus result = PK11_Authenticate(slot, PR_TRUE, NULL);
if (result != SECSuccess) {
- PK11_FreeSlot(slot);
+ FreeSlot(slot);
return std::wstring();
}
@@ -83,12 +82,16 @@ std::wstring NSSDecryptor::Decrypt(const std::string& crypt) const {
SECItem reply;
reply.data = NULL;
reply.len = 0;
+#if defined(OS_LINUX)
+ result = PK11SDR_DecryptWithSlot(slot, &request, &reply, NULL);
+#else
result = PK11SDR_Decrypt(&request, &reply, NULL);
+#endif // defined(OS_LINUX)
if (result == SECSuccess)
plain.assign(reinterpret_cast<char*>(reply.data), reply.len);
SECITEM_FreeItem(&reply, PR_FALSE);
- PK11_FreeSlot(slot);
+ FreeSlot(slot);
} else {
// Deletes the leading '~' before decoding.
net::Base64Decode(crypt.substr(1), &plain);
« no previous file with comments | « chrome/browser/importer/firefox_profile_lock_unittest.cc ('k') | chrome/browser/importer/nss_decryptor_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698