OLD | NEW |
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_system_nss.h" | 5 #include "chrome/utility/importer/nss_decryptor_system_nss.h" |
6 | 6 |
7 #include <pk11pub.h> | 7 #include <pk11pub.h> |
8 #include <pk11sdr.h> | 8 #include <pk11sdr.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/logging.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
13 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
14 #include "crypto/nss_util.h" | 15 #include "crypto/nss_util.h" |
15 | 16 |
16 NSSDecryptor::NSSDecryptor() : is_nss_initialized_(false), db_slot_(NULL) {} | 17 NSSDecryptor::NSSDecryptor() : is_nss_initialized_(false), db_slot_(NULL) {} |
17 NSSDecryptor::~NSSDecryptor() { | 18 NSSDecryptor::~NSSDecryptor() { |
18 if (db_slot_) { | 19 if (db_slot_) { |
19 // Deliberately leave the user db open, just in case we need to open more | 20 // Deliberately leave the user db open, just in case we need to open more |
20 // than one, because there's an NSS bug with reopening user dbs. | 21 // than one, because there's an NSS bug with reopening user dbs. |
21 // https://bugzilla.mozilla.org/show_bug.cgi?id=506140 | 22 // https://bugzilla.mozilla.org/show_bug.cgi?id=506140 |
22 // SECMOD_CloseUserDB(db_slot_); | 23 // SECMOD_CloseUserDB(db_slot_); |
23 PK11_FreeSlot(db_slot_); | 24 PK11_FreeSlot(db_slot_); |
24 } | 25 } |
25 } | 26 } |
26 | 27 |
27 bool NSSDecryptor::Init(const base::FilePath& dll_path, | 28 bool NSSDecryptor::Init(const base::FilePath& dll_path, |
28 const base::FilePath& db_path) { | 29 const base::FilePath& db_path) { |
| 30 LOG(ERROR) << "HIIIIIIIIIIIIIIIIIIIIIIIIIII"; |
29 crypto::EnsureNSSInit(); | 31 crypto::EnsureNSSInit(); |
30 is_nss_initialized_ = true; | 32 is_nss_initialized_ = true; |
31 const std::string modspec = | 33 const std::string modspec = |
32 base::StringPrintf( | 34 base::StringPrintf( |
33 "configDir='%s' tokenDescription='Firefox NSS database' " | 35 "configDir='%s' tokenDescription='Firefox NSS database' " |
34 "flags=readOnly", | 36 "flags=readOnly", |
35 db_path.value().c_str()); | 37 db_path.value().c_str()); |
36 db_slot_ = SECMOD_OpenUserDB(modspec.c_str()); | 38 db_slot_ = SECMOD_OpenUserDB(modspec.c_str()); |
37 return db_slot_ != NULL; | 39 return db_slot_ != NULL; |
38 } | 40 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 } | 265 } |
264 | 266 |
265 loser: | 267 loser: |
266 if (arena) PORT_FreeArena(arena, PR_TRUE); | 268 if (arena) PORT_FreeArena(arena, PR_TRUE); |
267 if (key) PK11_FreeSymKey(key); | 269 if (key) PK11_FreeSymKey(key); |
268 if (params) SECITEM_ZfreeItem(params, PR_TRUE); | 270 if (params) SECITEM_ZfreeItem(params, PR_TRUE); |
269 if (possibleResult.data) SECITEM_ZfreeItem(&possibleResult, PR_FALSE); | 271 if (possibleResult.data) SECITEM_ZfreeItem(&possibleResult, PR_FALSE); |
270 | 272 |
271 return rv; | 273 return rv; |
272 } | 274 } |
OLD | NEW |