From ce9212924039fba4e479760bba86c61b0d91c469 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 16 Dec 2014 13:10:09 +0100 Subject: 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 Provided patch extended to release the memory. --- g10/call-agent.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'g10/call-agent.c') 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; } -- cgit v1.2.3