Fix #559: Skip caching key with zero object handle#560
Conversation
It might happen that the object with zero object handle gets to cache_key which then result in unnecessary failure when caching the key. This skips the key caching if the object handle is 0.
|
This will probably need some sort of test so it's just a draft for now. |
simo5
left a comment
There was a problem hiding this comment.
Minor nits, but otherwise LGTM!
| } | ||
|
|
||
| obj_handle = p11prov_obj_get_handle(obj); | ||
| if (obj_handle == 0) { |
There was a problem hiding this comment.
please us CK_INVALID_HANDLE here.
|
|
||
| obj_handle = p11prov_obj_get_handle(obj); | ||
| if (obj_handle == 0) { | ||
| P11PROV_debug("Skip caching key with zero object handle"); |
|
Do you have a way to add a test that exercises this code path ? |
I might be able to get it in some integration test with nginx. This is hopefully the last issue so once I get it all working, I would like to start looking into getting the fixes upstream which means adding the tests for the current patches where possible so will try then. |
|
Interestingly after this change, the skip is not even happening. I have done some experiments and just purely getting the handle before the |
This is a solution for #559 .
It might happen that the object with zero object handle gets to cache_key which then result in unnecessary failure when caching the key. This skips the key caching if the object handle is 0.
Interestingly after this the handshake became much quicker so it might have some impact on performance as well. I can't say it for sure if it impacts production as I use everything with debug build but it should save some session logins for sure.
Checklist
Reviewer's checklist: