Add FindObjectsFinalize to getNextEmptySlot.

Signed-off-by: Ying Li <ying.li@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
This commit is contained in:
Ying Li 2015-11-11 16:37:58 -08:00 committed by David Lawrence
parent 10057562d8
commit 38a5b5a342
2 changed files with 6 additions and 0 deletions

View File

@ -545,6 +545,10 @@ func getNextEmptySlot(ctx IPKCS11Ctx, session pkcs11.SessionHandle) ([]byte, err
logrus.Debugf("Failed to find: %s %v", err.Error(), b) logrus.Debugf("Failed to find: %s %v", err.Error(), b)
return nil, err return nil, err
} }
if err = ctx.FindObjectsFinal(session); err != nil {
logrus.Debugf("Failed to finalize: %s\n", err.Error())
return nil, err
}
for _, obj := range objs { for _, obj := range objs {
// Retrieve the slot ID // Retrieve the slot ID
attr, err := ctx.GetAttributeValue(session, obj, attrTemplate) attr, err := ctx.GetAttributeValue(session, obj, attrTemplate)

View File

@ -532,6 +532,7 @@ func TestYubiAddKeyCleansUpOnError(t *testing.T) {
setupErrors, setupErrors,
"FindObjectsInit", "FindObjectsInit",
"FindObjects", "FindObjects",
"FindObjectsFinal",
"CreateObject", "CreateObject",
), true) ), true)
@ -629,6 +630,7 @@ func TestYubiImportKeyCleansUpOnError(t *testing.T) {
setupErrors, setupErrors,
"FindObjectsInit", "FindObjectsInit",
"FindObjects", "FindObjects",
"FindObjectsFinal",
"CreateObject", "CreateObject",
), true) ), true)