suppress errors in pkcs15 card detection if we don't know whether we really have a pkcs15 card

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2640 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2005-10-08 11:08:34 +00:00
parent 191f2af7ab
commit c7a8e84caf
2 changed files with 11 additions and 3 deletions

View File

@ -170,7 +170,7 @@ int sc_enum_apps(sc_card_t *card)
if (r)
return r;
if (card->ef_dir->type != SC_FILE_TYPE_WORKING_EF) {
sc_error(card->ctx, "EF(DIR) is not a working EF.\n");
sc_debug(card->ctx, "EF(DIR) is not a working EF.\n");
sc_file_free(card->ef_dir);
card->ef_dir = NULL;
return SC_ERROR_INVALID_CARD;

View File

@ -517,16 +517,24 @@ static int sc_pkcs15_bind_internal(sc_pkcs15_card_t *p15card)
goto end;
if (p15card->file_odf == NULL) {
/* check if an ODF is present; suppress errors as we
* don't know yet whether we have a pkcs15 card */
tmppath = p15card->file_app->path;
sc_append_path_id(&tmppath, (const u8 *) "\x50\x31", 2);
card->ctx->suppress_errors++;
err = sc_select_file(card, &tmppath, &p15card->file_odf);
card->ctx->suppress_errors--;
} else {
tmppath = p15card->file_odf->path;
sc_file_free(p15card->file_odf);
p15card->file_odf = NULL;
err = sc_select_file(card, &tmppath, &p15card->file_odf);
}
err = sc_select_file(card, &tmppath, &p15card->file_odf);
if (err) /* FIXME: finish writing error reporting stuff */
if (err != SC_SUCCESS) {
sc_debug(ctx, "EF(ODF) not found in '%s'\n", sc_print_path(&tmppath));
goto end;
}
/* XXX: fix buffer overflow. Silently truncate ODF if it
* is too large. --okir */