summaryrefslogtreecommitdiffstats
path: root/g10/call-agent.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-12-16 13:10:09 +0100
committerWerner Koch <wk@gnupg.org>2014-12-16 13:10:09 +0100
commitce9212924039fba4e479760bba86c61b0d91c469 (patch)
treeac1ade9dbb0883dc2807534148ecfe24c2169e3f /g10/call-agent.c
parentpo: Update Russian translation (diff)
downloadgnupg2-ce9212924039fba4e479760bba86c61b0d91c469.tar.xz
gnupg2-ce9212924039fba4e479760bba86c61b0d91c469.zip
gpg: Show private DO information in the card status.
* g10/call-agent.c (agent_release_card_info): Free private_do. (learn_status_cb): Parse PRIVATE-DO-n stati. -- Reported-by: Damien Goutte-Gattat <dgouttegattat@incenp.org> Provided patch extended to release the memory.
Diffstat (limited to '')
-rw-r--r--g10/call-agent.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 0450b8165..a98a177ad 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -471,6 +471,8 @@ get_serialno_cb (void *opaque, const char *line)
void
agent_release_card_info (struct agent_card_info_s *info)
{
+ int i;
+
if (!info)
return;
@@ -482,8 +484,14 @@ agent_release_card_info (struct agent_card_info_s *info)
xfree (info->login_data); info->login_data = NULL;
info->cafpr1valid = info->cafpr2valid = info->cafpr3valid = 0;
info->fpr1valid = info->fpr2valid = info->fpr3valid = 0;
+ for (i=0; i < DIM(info->private_do); i++)
+ {
+ xfree (info->private_do[i]);
+ info->private_do[i] = NULL;
+ }
}
+
static gpg_error_t
learn_status_cb (void *opaque, const char *line)
{
@@ -650,6 +658,14 @@ learn_status_cb (void *opaque, const char *line)
parm->key_attr[keyno].nbits = nbits;
}
}
+ else if (keywordlen == 12 && !memcmp (keyword, "PRIVATE-DO-", 11)
+ && strchr("1234", keyword[11]))
+ {
+ int no = keyword[11] - '1';
+ assert (no >= 0 && no <= 3);
+ xfree (parm->private_do[no]);
+ parm->private_do[no] = unescape_status_string (line);
+ }
return 0;
}