pkcs15init: when deleting object, do not try to select object file without valid path
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5336 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
622570a28e
commit
7b6cf4219e
|
@ -2696,7 +2696,7 @@ sc_pkcs15init_delete_object(struct sc_pkcs15_card *p15card, struct sc_profile *p
|
||||||
struct sc_file *file = NULL;
|
struct sc_file *file = NULL;
|
||||||
struct sc_path path;
|
struct sc_path path;
|
||||||
struct sc_pkcs15_df *df;
|
struct sc_pkcs15_df *df;
|
||||||
int r, stored_in_ef = 0;
|
int r = 0, stored_in_ef = 0;
|
||||||
|
|
||||||
LOG_FUNC_CALLED(ctx);
|
LOG_FUNC_CALLED(ctx);
|
||||||
switch(obj->type & SC_PKCS15_TYPE_CLASS_MASK) {
|
switch(obj->type & SC_PKCS15_TYPE_CLASS_MASK) {
|
||||||
|
@ -2717,13 +2717,14 @@ sc_pkcs15init_delete_object(struct sc_pkcs15_card *p15card, struct sc_profile *p
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_log(ctx, "delete object(type:%X) with path(type:%X,%s)", obj->type, path.type, sc_print_path(&path));
|
sc_log(ctx, "delete object(type:%X) with path(type:%X,%s)", obj->type, path.type, sc_print_path(&path));
|
||||||
r = sc_select_file(p15card->card, &path, &file);
|
if (path.len || path.aid.len) {
|
||||||
if (r != SC_ERROR_FILE_NOT_FOUND)
|
r = sc_select_file(p15card->card, &path, &file);
|
||||||
LOG_TEST_RET(ctx, r, "select object path failed");
|
if (r != SC_ERROR_FILE_NOT_FOUND)
|
||||||
|
LOG_TEST_RET(ctx, r, "select object path failed");
|
||||||
|
|
||||||
stored_in_ef = (file->type != SC_FILE_TYPE_DF);
|
stored_in_ef = (file->type != SC_FILE_TYPE_DF);
|
||||||
|
sc_file_free(file);
|
||||||
sc_file_free(file);
|
}
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
/* If the object is stored in a normal EF, try to delete the EF. */
|
/* If the object is stored in a normal EF, try to delete the EF. */
|
||||||
|
|
Loading…
Reference in New Issue