[git] Pinentry - branch, master, updated. pinentry-0.9.5-19-gbfd4cf3

by Neal H. Walfield cvs at cvs.gnupg.org
Mon Aug 24 10:43:38 CEST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The standard pinentry collection".

The branch, master has been updated
       via  bfd4cf3bee8c9e4a3af825c95694b8af098b1cb2 (commit)
       via  7e91e5f71c86c3899c7f256d7ae9d872e692dd28 (commit)
      from  13e09800a997845906bfb10ac3379bad00e6e63d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bfd4cf3bee8c9e4a3af825c95694b8af098b1cb2
Author: Neal H. Walfield <neal at gnu.org>
Date:   Mon Aug 24 10:43:33 2015 +0200

    tty: When reading the password, print any supplied error message.
    
    * tty/pinentry-tty.c (password): Print any supplied error message.

diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c
index b122949..49571ba 100644
--- a/tty/pinentry-tty.c
+++ b/tty/pinentry-tty.c
@@ -362,6 +362,8 @@ password (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
   if (! msg)
     msg = "Enter your passphrase.";
 
+  dump_error_text (ttyfo, pinentry->error);
+
   fprintf (ttyfo, "%s\n ", msg);
 
   while (! done)

commit 7e91e5f71c86c3899c7f256d7ae9d872e692dd28
Author: Neal H. Walfield <neal at gnu.org>
Date:   Mon Aug 24 10:42:40 2015 +0200

    tty: Refactor the code for printing error messages.
    
    * tty/pinentry-tty.c (dump_error_text): New function to display error
    messages.
    (confirm): Use it.
    (password): Likewise.

diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c
index edec16f..b122949 100644
--- a/tty/pinentry-tty.c
+++ b/tty/pinentry-tty.c
@@ -124,6 +124,41 @@ button (char *text, char *default_text, FILE *ttyfo)
   return *highlight;
 }
 
+static void
+dump_error_text (FILE *ttyfo, const char *text)
+{
+  int lines = 0;
+
+  if (! text || ! *text)
+    return;
+
+  for (;;)
+    {
+      const char *eol = strchr (text, '\n');
+      if (! eol)
+	eol = text + strlen (text);
+
+      lines ++;
+
+      fwrite ("\n *** ", 6, 1, ttyfo);
+      fputs (ALERT_START, ttyfo);
+      fwrite (text, (size_t) (eol - text), 1, ttyfo);
+      fputs (NORMAL_RESTORE, ttyfo);
+
+      if (! *eol)
+	break;
+
+      text = eol + 1;
+    }
+
+  if (lines > 1)
+    fputc ('\n', ttyfo);
+  else
+    fwrite (" ***\n", 5, 1, ttyfo);
+
+  fputc ('\n', ttyfo);
+}
+
 static int
 confirm (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
 {
@@ -135,9 +170,7 @@ confirm (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
 
   int ret;
 
-  if (pinentry->error)
-    fprintf (ttyfo, "*** %s%s%s ***\n",
-	     ALERT_START, pinentry->error, NORMAL_RESTORE);
+  dump_error_text (ttyfo, pinentry->error);
 
   msg = pinentry->description;
   if (! msg)
@@ -382,11 +415,9 @@ password (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
 	      done = 1;
 	    }
 	  else
-	    fprintf (ttyfo, "*** %s%s%s ***\n",
-		     ALERT_START,
-		     pinentry->repeat_error_string
-		     ?: "Passphrases don't match.",
-		     NORMAL_RESTORE);
+	    dump_error_text (ttyfo,
+			     pinentry->repeat_error_string
+			     ?: "Passphrases don't match.");
 
 	  secmem_free (passphrase2);
 	}

-----------------------------------------------------------------------

Summary of changes:
 tty/pinentry-tty.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 41 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
The standard pinentry collection
http://git.gnupg.org




More information about the Gnupg-commits mailing list