From 4ed941ff26783c4fabfe2079029f8e436eb7e340 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 12 Oct 2018 11:36:59 +0900 Subject: [PATCH] agent: Fix message for ACK button. * agent/divert-scd.c (getpin_cb): Display correct message. Signed-off-by: NIIBE Yutaka --- agent/divert-scd.c | 50 +++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/agent/divert-scd.c b/agent/divert-scd.c index ad9b9ee2f..baa1cc3eb 100644 --- a/agent/divert-scd.c +++ b/agent/divert-scd.c @@ -276,27 +276,49 @@ getpin_cb (void *opaque, const char *desc_text, const char *info, } else if (maxbuf == 1) /* Open the pinentry. */ { - if (info && strcmp (info, "--ack") != 0) + if (info) { - char *desc, *desc2; + char *desc; + const char *desc2; - if ( asprintf (&desc, - L_("%s%%0A%%0AUse the reader's pinpad for input."), - info) < 0 ) + if (!strcmp (info, "--ack")) + { + desc2 = L_("Push ACK button on card/token."); + + if (desc_text) + { + desc = strconcat (desc_text, + has_percent0A_suffix (desc_text) + ? "%0A" : "%0A%0A", + desc2, NULL); + desc2 = NULL; + } + else + desc = NULL; + } + else + { + desc2 = NULL; + + if (desc_text) + desc = strconcat (desc_text, + has_percent0A_suffix (desc_text) + ? "%0A" : "%0A%0A", + info, "%0A%0A", + L_("Use the reader's pinpad for input."), + NULL); + else + desc = strconcat (info, "%0A%0A", + L_("Use the reader's pinpad for input."), + NULL); + } + + if (!desc2 && !desc) rc = gpg_error_from_syserror (); else { - /* Prepend DESC_TEXT to INFO. */ - if (desc_text) - desc2 = strconcat (desc_text, - has_percent0A_suffix (desc_text) - ? "%0A" : "%0A%0A", - desc, NULL); - else - desc2 = NULL; rc = agent_popup_message_start (ctrl, desc2? desc2:desc, NULL); - xfree (desc2); xfree (desc); } }