From 1ac189f2df6cedab3a133baca69558fdf6a908d4 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 18 Mar 2021 11:29:31 +0100 Subject: 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 --- tools/card-call-scd.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools/card-call-scd.c') diff --git a/tools/card-call-scd.c b/tools/card-call-scd.c index 0bb1eb538..95f28e564 100644 --- a/tools/card-call-scd.c +++ b/tools/card-call-scd.c @@ -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); -- cgit v1.2.3