pkcs11: Use 1st slot as default, not slot '0'. #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WARNING: this might break some setups but might be a good idea in the long run.
Background:
After init softhsm2 changes the name of a slot. e.g. the first slot gets a random name after initialization (not '0'). This breaks the unit tests (patch for this in #44 ). According to https://issues.opendnssec.org/browse/SUPPORT-190 this is correct behavior and one shouldn't rely on the slot number in the first place. So the 'correct' patch would be to have parse_uri walk through all slots and find the token with the right name/serial/whatever if no slot is given[1]. This said, the 'first' slot might be a better default than '0' because it will always exist, whereas '0' might not (as it's the case with softhsm2). Also, if available, slot '0' should be the first in the list so I suppose in most cases this shouldn't make any difference (but only have one type of hardware token to test this theory at hand).
[1] Code for this might be borrowed from https://ludovicrousseau.blogspot.com/2011/04/pykc11-provided-samples-getinfopy.html