nss: inspect returnvalue of token check

PK11_IsPresent() checks for the token for the given slot is available,
and sets needlogin flags for the PK11_Authenticate() call.  Should it
return false, we should however treat it as an error and bail out.

Closes https://github.com/curl/curl/pull/4110
This commit is contained in:
Daniel Gustafsson 2019-07-12 16:13:31 +02:00 committed by Jay Satiro
parent c7f3c073f4
commit e5b371dc51
1 changed files with 4 additions and 1 deletions

View File

@ -691,7 +691,10 @@ static CURLcode nss_load_key(struct connectdata *conn, int sockindex,
tmp = SECMOD_WaitForAnyTokenEvent(pem_module, 0, 0);
if(tmp)
PK11_FreeSlot(tmp);
PK11_IsPresent(slot);
if(!PK11_IsPresent(slot)) {
PK11_FreeSlot(slot);
return CURLE_SSL_CERTPROBLEM;
}
status = PK11_Authenticate(slot, PR_TRUE, SSL_SET_OPTION(key_passwd));
PK11_FreeSlot(slot);