call sc_select_file only if pin->path is actually set

Thanks to Andrej Komelj <akomelj@email.si>


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1784 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2004-05-20 09:09:30 +00:00
parent c35e006c34
commit 8147c22a93
1 changed files with 21 additions and 12 deletions

View File

@ -186,10 +186,13 @@ int sc_pkcs15_verify_pin(struct sc_pkcs15_card *p15card,
card = p15card->card;
r = sc_lock(card);
SC_TEST_RET(card->ctx, r, "sc_lock() failed");
r = sc_select_file(card, &pin->path, NULL);
if (r) {
sc_unlock(card);
return r;
/* the path in the pin object is optional */
if (pin->path.len > 0) {
r = sc_select_file(card, &pin->path, NULL);
if (r) {
sc_unlock(card);
return r;
}
}
/* Initialize arguments */
@ -254,10 +257,13 @@ int sc_pkcs15_change_pin(struct sc_pkcs15_card *p15card,
card = p15card->card;
r = sc_lock(card);
SC_TEST_RET(card->ctx, r, "sc_lock() failed");
r = sc_select_file(card, &pin->path, NULL);
if (r) {
sc_unlock(card);
return r;
/* the path in the pin object is optional */
if (pin->path.len > 0) {
r = sc_select_file(card, &pin->path, NULL);
if (r) {
sc_unlock(card);
return r;
}
}
/* set pin_cmd data */
@ -317,10 +323,13 @@ int sc_pkcs15_unblock_pin(struct sc_pkcs15_card *p15card,
card = p15card->card;
r = sc_lock(card);
SC_TEST_RET(card->ctx, r, "sc_lock() failed");
r = sc_select_file(card, &pin->path, NULL);
if (r) {
sc_unlock(card);
return r;
/* the path in the pin object is optional */
if (pin->path.len > 0) {
r = sc_select_file(card, &pin->path, NULL);
if (r) {
sc_unlock(card);
return r;
}
}
/* set pin_cmd data */