summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-03-08 22:50:43 +0100
committerStef Walter <stefw@gnome.org>2013-03-08 22:54:56 +0100
commitb5660380769aa5b1c9b51af7e0fd2f18ed463a7e (patch)
treecc6e45013196ed22a723d1dec90f9e20139a761d
parentab14d9291df41b27f70ec3158d94f50f68ed80e1 (diff)
downloadp11-kit-b5660380769aa5b1c9b51af7e0fd2f18ed463a7e.tar.gz
iter: Don't skip tokens that don't have CKF_TOKEN_INITIALIZED
This flag is not required to be set unless C_InitToken has been called. Many modules, like libnssckbi.so, do not set this flag.
-rw-r--r--p11-kit/iter.c4
-rw-r--r--p11-kit/tests/test-iter.c33
2 files changed, 0 insertions, 37 deletions
diff --git a/p11-kit/iter.c b/p11-kit/iter.c
index 1807afe..7f23c53 100644
--- a/p11-kit/iter.c
+++ b/p11-kit/iter.c
@@ -482,10 +482,6 @@ move_next_session (P11KitIter *iter)
if (rv != CKR_OK || !p11_match_uri_token_info (&iter->match_token, &tinfo))
continue;
- /* Token is not initialized, we're not going to get further, so skip */
- if (!(tinfo.flags & CKF_TOKEN_INITIALIZED))
- continue;
-
rv = (iter->module->C_OpenSession) (iter->slot, iter->session_flags,
NULL, NULL, &iter->session);
if (rv != CKR_OK)
diff --git a/p11-kit/tests/test-iter.c b/p11-kit/tests/test-iter.c
index 275d2d2..81aa06c 100644
--- a/p11-kit/tests/test-iter.c
+++ b/p11-kit/tests/test-iter.c
@@ -806,38 +806,6 @@ test_getslotlist_fail_late (CuTest *tc)
}
static void
-test_token_not_initialized (CuTest *tc)
-{
- CK_FUNCTION_LIST module;
- P11KitIter *iter;
- CK_RV rv;
- int at;
-
- rv = p11_kit_initialize_module (&mock_module);
- CuAssertTrue (tc, rv == CKR_OK);
-
- memcpy (&module, &mock_module, sizeof (CK_FUNCTION_LIST));
- module.C_GetTokenInfo = mock_C_GetTokenInfo_not_initialized;
-
- iter = p11_kit_iter_new (NULL);
- p11_kit_iter_begin_with (iter, &module, 0, 0);
-
- at= 0;
- while ((rv = p11_kit_iter_next (iter)) == CKR_OK)
- at++;
-
- CuAssertTrue (tc, rv == CKR_CANCEL);
-
- /* Should fail on the first iteration */
- CuAssertIntEquals (tc, 0, at);
-
- p11_kit_iter_free (iter);
-
- rv = p11_kit_finalize_module (&mock_module);
- CuAssertTrue (tc, rv == CKR_OK);
-}
-
-static void
test_open_session_fail (CuTest *tc)
{
CK_FUNCTION_LIST module;
@@ -1120,7 +1088,6 @@ main (void)
SUITE_ADD_TEST (suite, test_module_mismatch);
SUITE_ADD_TEST (suite, test_getslotlist_fail_first);
SUITE_ADD_TEST (suite, test_getslotlist_fail_late);
- SUITE_ADD_TEST (suite, test_token_not_initialized);
SUITE_ADD_TEST (suite, test_open_session_fail);
SUITE_ADD_TEST (suite, test_find_init_fail);
SUITE_ADD_TEST (suite, test_find_objects_fail);