1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

scd: Fix how select_additional_application is called.

* scd/app.c (check_application_conflict): Check against current APP.
(select_additional_application): Update current_apptype of CTRL.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2019-08-21 11:16:12 +09:00
parent 09d000babb
commit 4781c4a866

View File

@ -270,8 +270,6 @@ check_application_conflict (card_t card, const char *name,
const unsigned char *serialno_bin,
size_t serialno_bin_len)
{
app_t app;
if (!card || !name)
return 0;
if (!card->app)
@ -284,12 +282,6 @@ check_application_conflict (card_t card, const char *name,
return 0; /* The card does not match the requested S/N. */
}
/* Check whether the requested NAME matches any already selected
* application. */
for (app = card->app; app; app = app->next)
if (!ascii_strcasecmp (strapptype (app->apptype), name))
return 0;
if (card->app->apptype == APPTYPE_UNDEFINED)
return 0;
@ -664,7 +656,7 @@ select_application (ctrl_t ctrl, const char *name, card_t *r_card,
card_top = card;
}
ctrl->current_apptype = card->app ? card->app->apptype : 0;
ctrl->current_apptype = card->app ? card->app->apptype : APPTYPE_NONE;
}
unlock_card (card);
}
@ -712,9 +704,10 @@ select_additional_application (ctrl_t ctrl, const char *name)
* maybe_switch_app will do that anyway. */
err = 0;
app = NULL;
ctrl->current_apptype = req_apptype;
log_debug ("current_apptype is set to %s\n", name);
goto leave;
}
app = NULL;
/* Allocate a new app object. */
app = xtrycalloc (1, sizeof *app);