memcpy(pin, creds->pin, creds->pin_size);
pin_len = creds->pin_size;
+
+ ret = 0;
} else {
if (info->tinfo.flags & CKF_USER_PIN_COUNT_LOW)
flags |= GNUTLS_PKCS11_PIN_COUNT_LOW;
}
pin_len = strlen(pin);
- if (ret == GNUTLS_E_PKCS11_PIN_SAVE && creds) {
+ }
+
+ rv = pakchois_login(pks, CKU_USER, (unsigned char *)pin, pin_len);
+
+ if (ret == GNUTLS_E_PKCS11_PIN_SAVE && creds && (rv==CKR_OK||rv==CKR_USER_ALREADY_LOGGED_IN)) {
memcpy(creds->pin, pin, pin_len);
creds->pin_size = pin_len;
- }
}
- rv = pakchois_login(pks, CKU_USER, (unsigned char *)pin, pin_len);
/* Try to scrub the pin off the stack. Clever compilers will
* probably optimize this away, oh well. */
memset(pin, 0, sizeof pin);