{"action":"closed","issue":{"url":"https://api.github.com/repos/OpenSC/libp11/issues/211","repository_url":"https://api.github.com/repos/OpenSC/libp11","labels_url":"https://api.github.com/repos/OpenSC/libp11/issues/211/labels{/name}","comments_url":"https://api.github.com/repos/OpenSC/libp11/issues/211/comments","events_url":"https://api.github.com/repos/OpenSC/libp11/issues/211/events","html_url":"https://github.com/OpenSC/libp11/issues/211","id":307458607,"number":211,"title":"Enhancement: Allow iterating through all valuable tokens","user":{"login":"frankmorgner","id":1266577,"avatar_url":"https://avatars0.githubusercontent.com/u/1266577?v=4","gravatar_id":"","url":"https://api.github.com/users/frankmorgner","html_url":"https://github.com/frankmorgner","followers_url":"https://api.github.com/users/frankmorgner/followers","following_url":"https://api.github.com/users/frankmorgner/following{/other_user}","gists_url":"https://api.github.com/users/frankmorgner/gists{/gist_id}","starred_url":"https://api.github.com/users/frankmorgner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frankmorgner/subscriptions","organizations_url":"https://api.github.com/users/frankmorgner/orgs","repos_url":"https://api.github.com/users/frankmorgner/repos","events_url":"https://api.github.com/users/frankmorgner/events{/privacy}","received_events_url":"https://api.github.com/users/frankmorgner/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-21T23:55:36Z","updated_at":"2018-03-24T08:15:19Z","closed_at":"2018-03-24T08:15:19Z","author_association":"MEMBER","body":"`PKCS11_find_token()` returns a slot that most likely has usable PINs, keys and certificates. However, when multiple cards are available, there will be multiple such slots. (Note that a single card with multiple PINs will also create multiple slots which results in the same problem).\r\n\r\nWhat I'd like to have is a way to loop over all valuable tokens. As workaround, it should be possible to use something like\r\n```\r\n\tfor (slot = PKCS11_find_token(ctx, slots, nslots);\r\n\t\t\tslot != NULL;\r\n\t\t\tslot++,\r\n\t\t\tnslots -= (slot - slots) / sizeof *slot,\r\n\t\t\tslots = slot,\r\n\t\t\tslot = PKCS11_find_token(ctx, slots, nslots)) {\r\n\t\t/* ... */\r\n\t}\r\n```\r\nIf this works, however, depends on the internal implementation of the slots. In my application (pam_p11), I'd like to avoid this dependency."}}
{"actor":{"display_login":"mtrojnar"}}