aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-11-27 09:59:19 +0100
committerWerner Koch <wk@gnupg.org>2020-11-27 10:00:21 +0100
commit5804db1a13d2cf8f4010d1257c586bed978c3173 (patch)
tree86bcb119db76c8a28c261ffe30ac75cc0aa0c051
parentbb591222c3c5cb1a1750b1b1dd26d0bc53b347cb (diff)
downloadgnupg-5804db1a13d2cf8f4010d1257c586bed978c3173.tar.gz
card: Netkey improvement for passwd.
* tools/gpg-card.c (cmd_passwd) [Netkey]: No Standard/QES menu if the card does not support it. Print no error in cases the user canceled.
-rw-r--r--tools/gpg-card.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/tools/gpg-card.c b/tools/gpg-card.c
index 9898c5e31..b4cd80c43 100644
--- a/tools/gpg-card.c
+++ b/tools/gpg-card.c
@@ -2733,24 +2733,30 @@ cmd_passwd (card_info_t info, char *argstr)
menu_used = 1;
- for (;;)
+ log_assert (DIM (info->chvinfo) >= 4);
+
+ /* If there is a qualified signature use a a menu to select
+ * between standard PIN and QES PINs. */
+ if (info->chvinfo[2] != -2 || info->chvinfo[3] != -2)
{
- xfree (answer);
- answer = get_selection (" 1 - Standard PIN/PUK\n"
- " 2 - PIN/PUK for qualified signature\n"
- " Q - quit\n");
- if (!ascii_strcasecmp (answer, "q"))
- goto leave;
- else if (!strcmp (answer, "1"))
- break;
- else if (!strcmp (answer, "2"))
+ for (;;)
{
- for_qualified = 1;
- break;
+ xfree (answer);
+ answer = get_selection (" 1 - Standard PIN/PUK\n"
+ " 2 - PIN/PUK for qualified signature\n"
+ " Q - quit\n");
+ if (!ascii_strcasecmp (answer, "q"))
+ goto leave;
+ else if (!strcmp (answer, "1"))
+ break;
+ else if (!strcmp (answer, "2"))
+ {
+ for_qualified = 1;
+ break;
+ }
}
}
- log_assert (DIM (info->chvinfo) >= 4);
if (info->chvinfo[for_qualified? 2 : 0] == -4)
{
while (!pinref)
@@ -2817,6 +2823,9 @@ cmd_passwd (card_info_t info, char *argstr)
{
if (!opt.interactive && !menu_used && !opt.verbose)
;
+ else if (gpg_err_code (err) == GPG_ERR_CANCELED
+ && gpg_err_source (err) == GPG_ERR_SOURCE_PINENTRY)
+ log_info ("%s\n", gpg_strerror (err));
else if (!ascii_strcasecmp (pinref, "PIV.81"))
log_error ("Error changing the PUK.\n");
else if (!ascii_strcasecmp (pinref, "OPENPGP.1") && reset_mode)