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

Side by Side Diff: chrome/utility/importer/nss_decryptor_win.cc

Issue 23799008: Fix import Firefox passwords on Windows (silent failure); plds4.dll and nspr4.dll no longer exist (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/utility/importer/nss_decryptor_win.h" 5 #include "chrome/utility/importer/nss_decryptor_win.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 9
10 namespace { 10 namespace {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 is_nss_initialized_(false) { 99 is_nss_initialized_(false) {
100 } 100 }
101 101
102 NSSDecryptor::~NSSDecryptor() { 102 NSSDecryptor::~NSSDecryptor() {
103 Free(); 103 Free();
104 } 104 }
105 105
106 bool NSSDecryptor::InitNSS(const base::FilePath& db_path, 106 bool NSSDecryptor::InitNSS(const base::FilePath& db_path,
107 base::NativeLibrary plds4_dll, 107 base::NativeLibrary plds4_dll,
108 base::NativeLibrary nspr4_dll) { 108 base::NativeLibrary nspr4_dll) {
109 // NSPR DLLs are already loaded now.
110 if (plds4_dll == NULL || nspr4_dll == NULL) {
111 Free();
112 return false;
113 }
114
115 // Gets the function address. 109 // Gets the function address.
116 NSS_Init = (NSSInitFunc) 110 NSS_Init = (NSSInitFunc)
117 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "NSS_Init"); 111 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "NSS_Init");
118 NSS_Shutdown = (NSSShutdownFunc) 112 NSS_Shutdown = (NSSShutdownFunc)
119 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "NSS_Shutdown"); 113 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "NSS_Shutdown");
120 PK11_GetInternalKeySlot = (PK11GetInternalKeySlotFunc) 114 PK11_GetInternalKeySlot = (PK11GetInternalKeySlotFunc)
121 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, 115 base::GetFunctionPointerFromNativeLibrary(nss3_dll_,
122 "PK11_GetInternalKeySlot"); 116 "PK11_GetInternalKeySlot");
123 PK11_FreeSlot = (PK11FreeSlotFunc) 117 PK11_FreeSlot = (PK11FreeSlotFunc)
124 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "PK11_FreeSlot"); 118 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "PK11_FreeSlot");
125 PK11_Authenticate = (PK11AuthenticateFunc) 119 PK11_Authenticate = (PK11AuthenticateFunc)
126 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "PK11_Authenticate"); 120 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "PK11_Authenticate");
127 PK11SDR_Decrypt = (PK11SDRDecryptFunc) 121 PK11SDR_Decrypt = (PK11SDRDecryptFunc)
128 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "PK11SDR_Decrypt"); 122 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "PK11SDR_Decrypt");
129 SECITEM_FreeItem = (SECITEMFreeItemFunc) 123 SECITEM_FreeItem = (SECITEMFreeItemFunc)
130 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "SECITEM_FreeItem"); 124 base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "SECITEM_FreeItem");
131 PL_ArenaFinish = (PLArenaFinishFunc) 125 // FireFox 22 and higher PL_ArenaFinish moved from plds4.dll to nss3.dll
Avi (use Gerrit) 2013/09/06 20:43:47 It's "Firefox" rather than "FireFox".
132 base::GetFunctionPointerFromNativeLibrary(plds4_dll, "PL_ArenaFinish"); 126 PL_ArenaFinish = (PLArenaFinishFunc)(
133 PR_Cleanup = (PRCleanupFunc) 127 (plds4_dll != NULL)
134 base::GetFunctionPointerFromNativeLibrary(nspr4_dll, "PR_Cleanup"); 128 ? base::GetFunctionPointerFromNativeLibrary(plds4_dll, "PL_ArenaFinish")
129 : base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "PL_ArenaFinish"));
Ilya Sherman 2013/09/06 21:32:47 nit: Please define a local variable for the DLL, r
130 // FireFox 22 and higher PR_Cleanup moved from nspr4.dll to nss3.dll
131 PR_Cleanup = (PRCleanupFunc)(
132 (nspr4_dll != NULL)
133 ? base::GetFunctionPointerFromNativeLibrary(nspr4_dll, "PR_Cleanup")
134 : base::GetFunctionPointerFromNativeLibrary(nss3_dll_, "PR_Cleanup"));
135 135
136 if (NSS_Init == NULL || NSS_Shutdown == NULL || 136 if (NSS_Init == NULL || NSS_Shutdown == NULL ||
137 PK11_GetInternalKeySlot == NULL || PK11_FreeSlot == NULL || 137 PK11_GetInternalKeySlot == NULL || PK11_FreeSlot == NULL ||
138 PK11_Authenticate == NULL || PK11SDR_Decrypt == NULL || 138 PK11_Authenticate == NULL || PK11SDR_Decrypt == NULL ||
139 SECITEM_FreeItem == NULL || PL_ArenaFinish == NULL || 139 SECITEM_FreeItem == NULL || PL_ArenaFinish == NULL ||
140 PR_Cleanup == NULL) { 140 PR_Cleanup == NULL) {
141 Free(); 141 Free();
142 return false; 142 return false;
143 } 143 }
144 144
(...skipping 23 matching lines...) Expand all
168 PK11_GetInternalKeySlot = NULL; 168 PK11_GetInternalKeySlot = NULL;
169 PK11_FreeSlot = NULL; 169 PK11_FreeSlot = NULL;
170 PK11_Authenticate = NULL; 170 PK11_Authenticate = NULL;
171 PK11SDR_Decrypt = NULL; 171 PK11SDR_Decrypt = NULL;
172 SECITEM_FreeItem = NULL; 172 SECITEM_FreeItem = NULL;
173 PL_ArenaFinish = NULL; 173 PL_ArenaFinish = NULL;
174 PR_Cleanup = NULL; 174 PR_Cleanup = NULL;
175 nss3_dll_ = NULL; 175 nss3_dll_ = NULL;
176 softokn3_dll_ = NULL; 176 softokn3_dll_ = NULL;
177 } 177 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698