1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

card: Print PIN descriptions and fix number of printed retry counters.

* tools/gpg-card.h (struct card_info_s): Add fields nmaxlen, nchvinfo,
and chvlabels.
* tools/card-call-scd.c (release_card_info): Free chvlabels.
(learn_status_cb): Parse CHV-LABEL.  Set nmaxlen and nchvinfo.
* tools/gpg-card.c (list_retry_counter): Print CHV labels.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2021-03-18 11:29:31 +01:00
parent ef29a960bf
commit 1ac189f2df
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 15 additions and 1 deletions

View file

@ -161,6 +161,7 @@ release_card_info (card_info_t info)
info->kinfo = kinfo;
}
info->chvusage[0] = info->chvusage[1] = 0;
xfree (info->chvlabels); info->chvlabels = NULL;
for (i=0; i < DIM(info->supported_keyalgo); i++)
{
free_strlist (info->supported_keyalgo[i]);
@ -909,6 +910,11 @@ learn_status_cb (void *opaque, const char *line)
parm->chvusage[0] = byte1;
parm->chvusage[1] = byte2;
}
else if (!memcmp (keyword, "CHV-LABEL", keywordlen))
{
xfree (parm->chvlabels);
parm->chvlabels = xstrdup (line);
}
break;
case 10:
@ -948,6 +954,7 @@ learn_status_cb (void *opaque, const char *line)
while (spacep (p))
p++;
}
parm->nchvmaxlen = 3;
for (i=0; *p && i < 3; i++)
{
parm->chvinfo[i] = atoi (p);
@ -956,6 +963,7 @@ learn_status_cb (void *opaque, const char *line)
while (spacep (p))
p++;
}
parm->nchvinfo = 3;
}
else
{
@ -967,6 +975,7 @@ learn_status_cb (void *opaque, const char *line)
while (spacep (p))
p++;
}
parm->nchvinfo = i;
}
xfree (buf);