From 4781c4a86608b57f9d1daf55b9b2970130fe6120 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 21 Aug 2019 11:16:12 +0900 Subject: [PATCH] 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 --- scd/app.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/scd/app.c b/scd/app.c index 40a711c5e..4e785930e 100644 --- a/scd/app.c +++ b/scd/app.c @@ -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);