aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-nks.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-06-25 09:25:58 +0000
committerWerner Koch <[email protected]>2020-06-25 09:27:26 +0000
commit2429e8559844e27de478d7e90834a714b3748834 (patch)
tree93ac764b4aacb7002605e14e31e62335951bbf25 /scd/app-nks.c
parentcard: Add password change menu for NKS cards. (diff)
downloadgnupg-2429e8559844e27de478d7e90834a714b3748834.tar.gz
gnupg-2429e8559844e27de478d7e90834a714b3748834.zip
scd:nks: Fix remaining tries warning in --reset mode.
* scd/app-nks.c (do_change_pin): Chnage computaion of 'remaining'. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/app-nks.c')
-rw-r--r--scd/app-nks.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/scd/app-nks.c b/scd/app-nks.c
index 8f0dfef99..53e166ed5 100644
--- a/scd/app-nks.c
+++ b/scd/app-nks.c
@@ -1758,15 +1758,6 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *pwidstr,
if (err)
return err;
- remaining = iso7816_verify_status (app_get_slot (app), pwid);
- if (remaining < 0)
- remaining = -1; /* We don't care about the concrete error. */
- if (remaining < 3)
- {
- if (remaining >= 0)
- log_info ("nks: PIN has %d attempts left\n", remaining);
- }
-
if ((flags & APP_CHANGE_FLAG_NULLPIN))
{
/* With the nullpin flag, we do not verify the PIN - it would
@@ -1811,11 +1802,21 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *pwidstr,
goto leave;
}
desc = parse_pwidstr (app, altpwidstr, 0, &dummy1, &dummy2);
+ remaining = iso7816_verify_status (app_get_slot (app), dummy2);
}
else
{
/* Regular change mode: Ask for the old PIN. */
desc = parse_pwidstr (app, pwidstr, 0, &dummy1, &dummy2);
+ remaining = iso7816_verify_status (app_get_slot (app), pwid);
+ }
+
+ if (remaining < 0)
+ remaining = -1; /* We don't care about the concrete error. */
+ if (remaining < 3)
+ {
+ if (remaining >= 0)
+ log_info ("nks: PIN has %d attempts left\n", remaining);
}
prompt = make_prompt (app, remaining, desc, NULL);