Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy: Do not assign duplicate slot IDs #282

Merged
merged 2 commits into from Feb 25, 2020

Conversation

ansasaki
Copy link
Contributor

This PR supersedes #281

Previously, when assigning the slot IDs to the mapping, it could happen that new slots were listed by the module before slots previously seen. In this case duplicate slot IDs would be assigned to different slots.

This change makes all the reused slot IDs to be assigned before the new slot IDs. It also tries to make the slot IDs monotonically crescent.

A reproducer test case was added.

Fixes #266

p11-kit/proxy.c Outdated Show resolved Hide resolved
p11-kit/proxy.c Outdated Show resolved Hide resolved
p11-kit/proxy.c Outdated Show resolved Hide resolved
Copy link
Member

@ueno ueno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

Previously, when re-mapping the slots, a slot ID could be assigned to
more than one device, causing errors when searching for the right
mapping (it would use the first found).

Also assign new slot IDs for new found slots, avoiding previously used
slot IDs.  The last assigned slot ID is stored in the proxy structure
in a new added field last_id.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
The test covers a case where duplicate slots IDs were assigned to two
different slots in the mapping.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
@ueno ueno merged commit 51c0781 into p11-glue:master Feb 25, 2020
@ueno ueno added the bug label Feb 26, 2020
@ueno ueno added this to the 0.23.21 milestone Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

httpd fails to get signatures when using p11-kit-proxy + engine_pkcs11 and new devices are added
2 participants