-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove complexity from slot reinitialization after fork
After fork the context handler will reset the PKCS#11 module by calling C_Initialize. After this all handles from the module should be considered invalidated. This combines the session opening and logging after fork to single function, and removes the relogin flag from functions where it's not needed. The new pkcs11_reload_slot() properly update the state so the normal functions operate as expected. This also fixes a memory leak after fork: if the slot was in logged-in state, a session was leaked from check_slot_fork_int because: 1. the "if loggedIn" clears state, and calls pkcs11_relogin() which also implicitly opens a session 2. the next "if haveSession" block fires also, and clears state, and calls pkcs11_reopen_session. This function will explicitly call C_OpenSession overwriting and leaking the session from step #1
- Loading branch information
Showing
6 changed files
with
31 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters