diff options
author | Daiki Ueno <dueno@redhat.com> | 2016-08-10 17:15:25 +0200 |
---|---|---|
committer | Stef Walter <stefw@redhat.com> | 2016-09-02 17:48:36 +0200 |
commit | 927c8e98f159607acf7fa8b0f5bcf9a4d0497742 (patch) | |
tree | d92740a833136fa5df416c7e284ab22aa1374003 /p11-kit/iter.c | |
parent | e0c5d429df6ebe2cb88425edf42f65bfb33f0b77 (diff) |
iter: Utilize 'slot-id' URI path attribute
https://bugs.freedesktop.org/show_bug.cgi?id=97245
Diffstat (limited to 'p11-kit/iter.c')
-rw-r--r-- | p11-kit/iter.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/p11-kit/iter.c b/p11-kit/iter.c index 6032513..4caf5d7 100644 --- a/p11-kit/iter.c +++ b/p11-kit/iter.c @@ -64,6 +64,7 @@ struct p11_kit_iter { CK_SLOT_INFO match_slot; CK_TOKEN_INFO match_token; CK_ATTRIBUTE *match_attrs; + CK_SLOT_ID match_slot_id; Callback *callbacks; /* The input modules */ @@ -181,6 +182,8 @@ p11_kit_iter_set_uri (P11KitIter *iter, attrs = p11_kit_uri_get_attributes (uri, &count); iter->match_attrs = p11_attrs_buildn (NULL, attrs, count); + iter->match_slot_id = p11_kit_uri_get_slot_id (uri); + minfo = p11_kit_uri_get_module_info (uri); if (minfo != NULL) memcpy (&iter->match_module, minfo, sizeof (CK_INFO)); @@ -194,10 +197,11 @@ p11_kit_iter_set_uri (P11KitIter *iter, memcpy (&iter->match_token, tinfo, sizeof (CK_TOKEN_INFO)); } } else { - /* Match any module version number*/ + /* Match any module version number and slot ID */ memset (&iter->match_module, 0, sizeof (iter->match_module)); iter->match_module.libraryVersion.major = (CK_BYTE)-1; iter->match_module.libraryVersion.minor = (CK_BYTE)-1; + iter->match_slot_id = (CK_SLOT_ID)-1; } } @@ -513,6 +517,8 @@ move_next_session (P11KitIter *iter) iter->slot = iter->slots[iter->saw_slots++]; assert (iter->module != NULL); + if (iter->match_slot_id != (CK_SLOT_ID)-1 && iter->slot != iter->match_slot_id) + continue; rv = (iter->module->C_GetSlotInfo) (iter->slot, &iter->slot_info); if (rv != CKR_OK || !p11_match_uri_slot_info (&iter->match_slot, &iter->slot_info)) continue; |