summaryrefslogtreecommitdiff
path: root/gtests
diff options
context:
space:
mode:
authorFranziskus Kiefer <franziskuskiefer@gmail.com>2017-08-17 11:18:37 +0200
committerFranziskus Kiefer <franziskuskiefer@gmail.com>2017-08-17 11:18:37 +0200
commit2a79ae3622420f7430cf198991b39d46f9c53ee2 (patch)
treec38cb1e1d37738bb32ec9164fa369587d280c474 /gtests
parent76bb9a64ae732f721826dc9051dc8701ce9831a5 (diff)
downloadnss-hg-2a79ae3622420f7430cf198991b39d46f9c53ee2.tar.gz
Bug 1389570 - set slot->flags for user pin initialized when in nodb mode, r=mt
Summary: NSS_NoDB_Init("."); PK11SlotInfo* slot = PK11_GetInternalKeySlot(); PK11_NeedUserInit(slot) used to returned PR_TRUE because we never set the init flag that's checked by that function when we start in noDB mode. This patch fixes that. As mentioned in the patch this is not the nicest way to fix this. The way login/init status and these flags are handled shold probably be rewritten. Differential Revision: https://nss-review.dev.mozaws.net/D406
Diffstat (limited to 'gtests')
-rw-r--r--gtests/softoken_gtest/softoken_gtest.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gtests/softoken_gtest/softoken_gtest.cc b/gtests/softoken_gtest/softoken_gtest.cc
index fc82f4185..23def6720 100644
--- a/gtests/softoken_gtest/softoken_gtest.cc
+++ b/gtests/softoken_gtest/softoken_gtest.cc
@@ -200,6 +200,19 @@ TEST_F(SoftokenTest, CreateObjectChangeToEmptyPassword) {
EXPECT_NE(nullptr, obj);
}
+class SoftokenNoDBTest : public ::testing::Test {};
+
+TEST_F(SoftokenNoDBTest, NeedUserInitNoDB) {
+ ASSERT_EQ(SECSuccess, NSS_NoDB_Init("."));
+ ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
+ ASSERT_TRUE(slot);
+ EXPECT_EQ(PR_FALSE, PK11_NeedUserInit(slot.get()));
+
+ // When shutting down in here we have to release the slot first.
+ slot = nullptr;
+ ASSERT_EQ(SECSuccess, NSS_Shutdown());
+}
+
} // namespace nss_test
int main(int argc, char **argv) {