Index: base/nss_util.cc |
diff --git a/base/nss_util.cc b/base/nss_util.cc |
index b14488103e861392ce6b6c212136380143550f76..a641f5dbb058196634fa5c05642745264cc39a1f 100644 |
--- a/base/nss_util.cc |
+++ b/base/nss_util.cc |
@@ -68,6 +68,17 @@ FilePath GetInitialConfigDirectory() { |
#endif // defined(OS_CHROMEOS) |
} |
+// This callback for NSS forwards all requests to a caller-specified |
+// PK11BlockingPasswordDelegate object. |
+char* PK11PasswordFunc(PK11SlotInfo* slot, PRBool retry, void* arg) { |
+ base::PK11BlockingPasswordDelegate* delegate = |
+ reinterpret_cast<base::PK11BlockingPasswordDelegate*>(arg); |
+ if (delegate) |
+ return delegate->RequestPassword(slot, retry); |
+ DLOG(ERROR) << "PK11 password requested with NULL arg"; |
+ return NULL; |
+} |
+ |
// NSS creates a local cache of the sqlite database if it detects that the |
// filesystem the database is on is much slower than the local disk. The |
// detection doesn't work with the latest versions of sqlite, such as 3.6.22 |
@@ -194,6 +205,8 @@ class NSSInitSingleton { |
} |
} |
+ PK11_SetPasswordFunc(PK11PasswordFunc); |
+ |
// If we haven't initialized the password for the NSS databases, |
// initialize an empty-string password so that we don't need to |
// log in. |