scd: Improve app selection for app "undefined".

* scd/app.c (app_new_register): Don't bail out early in undefined
mode.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-01-25 19:12:32 +01:00
parent c9f4c1f0de
commit 0415b80227
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 12 additions and 6 deletions

View File

@ -305,21 +305,27 @@ app_new_register (int slot, ctrl_t ctrl, const char *name,
}
}
/* For certain error codes, there is no need to try more. */
if (gpg_err_code (err) == GPG_ERR_CARD_NOT_PRESENT
|| gpg_err_code (err) == GPG_ERR_ENODEV)
goto leave;
/* Figure out the application to use. */
if (want_undefined)
{
/* We switch to the "undefined" application only if explicitly
requested. */
app->apptype = "UNDEFINED";
/* Clear the error so that we don't run through the application
* selection chain. */
err = 0;
}
else
err = gpg_error (GPG_ERR_NOT_FOUND);
{
/* For certain error codes, there is no need to try more. */
if (gpg_err_code (err) == GPG_ERR_CARD_NOT_PRESENT
|| gpg_err_code (err) == GPG_ERR_ENODEV)
goto leave;
/* Set a default error so that we run through the application
* selecion chain. */
err = gpg_error (GPG_ERR_NOT_FOUND);
}
if (err && is_app_allowed ("openpgp")
&& (!name || !strcmp (name, "openpgp")))