1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-10 13:04:23 +01:00

scd:nks: Fix remaining tries warning in --reset mode.

* scd/app-nks.c (do_change_pin): Change computation of 'remaining'.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
Backported-from-master: 2429e8559844e27de478d7e90834a714b3748834
GnuPG-bug-id: 6252
This commit is contained in:
Werner Koch 2020-06-25 11:25:58 +02:00
parent 60ba61e78e
commit a974d8aefa
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -1750,15 +1750,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
@ -1803,11 +1794,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);