Do not lose PIN when more slots match PKCS#11 URI (#1843372)
This commit is contained in:
parent
868439f73a
commit
ed59cb1783
@ -2722,6 +2722,9 @@ index a302c79c..879fe917 100644
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ provider_uri = pkcs11_uri_get(uri);
|
+ provider_uri = pkcs11_uri_get(uri);
|
||||||
|
+ if (pin == NULL && uri->pin != NULL) {
|
||||||
|
+ pin = uri->pin;
|
||||||
|
+ }
|
||||||
+ nkeys = 0;
|
+ nkeys = 0;
|
||||||
+ for (i = 0; i < p->module->nslots; i++) {
|
+ for (i = 0; i < p->module->nslots; i++) {
|
||||||
+ token = &p->module->slotinfo[i].token;
|
+ token = &p->module->slotinfo[i].token;
|
||||||
@ -2757,9 +2760,6 @@ index a302c79c..879fe917 100644
|
|||||||
+ provider_uri, (unsigned long)i,
|
+ provider_uri, (unsigned long)i,
|
||||||
token->label, token->manufacturerID, token->model,
|
token->label, token->manufacturerID, token->model,
|
||||||
token->serialNumber, token->flags);
|
token->serialNumber, token->flags);
|
||||||
+ if (pin == NULL && uri->pin != NULL) {
|
|
||||||
+ pin = uri->pin;
|
|
||||||
+ }
|
|
||||||
/*
|
/*
|
||||||
- * open session, login with pin and retrieve public
|
- * open session, login with pin and retrieve public
|
||||||
- * keys (if keyp is provided)
|
- * keys (if keyp is provided)
|
||||||
@ -2805,8 +2805,8 @@ index a302c79c..879fe917 100644
|
|||||||
+ pkcs11_fetch_certs(p, i, keyp, labelsp, &nkeys, uri);
|
+ pkcs11_fetch_certs(p, i, keyp, labelsp, &nkeys, uri);
|
||||||
+ uri->object = label;
|
+ uri->object = label;
|
||||||
}
|
}
|
||||||
+ pin = NULL; /* Will be cleaned up with URI */
|
|
||||||
}
|
}
|
||||||
|
+ pin = NULL; /* Will be cleaned up with URI */
|
||||||
|
|
||||||
/* now owned by caller */
|
/* now owned by caller */
|
||||||
*providerp = p;
|
*providerp = p;
|
||||||
|
Loading…
Reference in New Issue
Block a user