mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
scd: Skip S/N reading for the "undefined" application.
* scd/app.c (select_application): Skip serial number reading.
This commit is contained in:
parent
0bac31ee9f
commit
792e137ec7
25
scd/app.c
25
scd/app.c
@ -242,11 +242,14 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app)
|
||||
app_t app = NULL;
|
||||
unsigned char *result = NULL;
|
||||
size_t resultlen;
|
||||
int want_undefined;
|
||||
|
||||
(void)ctrl;
|
||||
|
||||
*r_app = NULL;
|
||||
|
||||
want_undefined = (name && !strcmp (name, "undefined"));
|
||||
|
||||
err = lock_reader (slot, ctrl);
|
||||
if (err)
|
||||
return err;
|
||||
@ -326,7 +329,10 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app)
|
||||
/* Fixme: We should now first check whether a card is at all
|
||||
present. */
|
||||
|
||||
/* Try to read the GDO file first to get a default serial number. */
|
||||
/* Try to read the GDO file first to get a default serial number.
|
||||
We skip this if the undefined application has been requested. */
|
||||
if (!want_undefined)
|
||||
{
|
||||
err = iso7816_select_file (slot, 0x3F00, 1, NULL, NULL);
|
||||
if (!err)
|
||||
err = iso7816_select_file (slot, 0x2F02, 0, NULL, NULL);
|
||||
@ -366,6 +372,7 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app)
|
||||
xfree (result);
|
||||
result = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* For certain error codes, there is no need to try more. */
|
||||
if (gpg_err_code (err) == GPG_ERR_CARD_NOT_PRESENT
|
||||
@ -373,6 +380,14 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app)
|
||||
goto leave;
|
||||
|
||||
/* Figure out the application to use. */
|
||||
if (want_undefined)
|
||||
{
|
||||
/* We switch to the "undefined" application only if explicitly
|
||||
requested. */
|
||||
app->apptype = "UNDEFINED";
|
||||
err = 0;
|
||||
}
|
||||
else
|
||||
err = gpg_error (GPG_ERR_NOT_FOUND);
|
||||
|
||||
if (err && is_app_allowed ("openpgp")
|
||||
@ -387,14 +402,6 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app)
|
||||
if (err && is_app_allowed ("geldkarte")
|
||||
&& (!name || !strcmp (name, "geldkarte")))
|
||||
err = app_select_geldkarte (app);
|
||||
if (err && is_app_allowed ("undefined")
|
||||
&& (name && !strcmp (name, "undefined")))
|
||||
{
|
||||
/* We switch to the "undefined" application only if explicitly
|
||||
requested. */
|
||||
app->apptype = "UNDEFINED";
|
||||
err = 0;
|
||||
}
|
||||
if (err && name)
|
||||
err = gpg_error (GPG_ERR_NOT_SUPPORTED);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user