[git] Pinentry - branch, master, updated. pinentry-0.9.6-2-g9cc13bb

by Werner Koch cvs at cvs.gnupg.org
Wed Sep 16 21:00:27 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  9cc13bbd6954928f8a7dae022728c13415816a67 (commit)
      from  c64d1f4a9ee2370090fd9a3469c16667057563aa (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 9cc13bbd6954928f8a7dae022728c13415816a67
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Sep 16 20:56:47 2015 +0200

    Add option "invisible-char".
    
    * pinentry/pinentry.h (struct pinentry): Add field invisible_char.
    * pinentry/pinentry.c (pinentry_reset): Restore that.
    (option_handler): Add option "invisible-char".
    * gtk+-2/pinentry-gtk-2.c (create_window): Set the invisible char if
    given.
    --
    
    The default GTK+ invisible character is pretty wide so that only ~16
    characters show up in the smalles pinentry.  This is a bit annoying if
    the passphrase is a longer due to the missing visual feedback.  By
    using #x2022 ("•") this allows for ~23 characters and a plain "*" even
    3 more characters.  Tastes are different so we allow to change that
    character at runtime.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c
index fdfdeaf..5ebdd64 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+-2/pinentry-gtk-2.c
@@ -1,7 +1,7 @@
 /* pinentry-gtk-2.c
    Copyright (C) 1999 Robert Bihlmeyer <robbe at orcus.priv.at>
    Copyright (C) 2001, 2002, 2007, 2015 g10 Code GmbH
-   Copyright (C) 2004 by Albrecht Dreß <albrecht.dress at arcor.de>
+   Copyright (C) 2004 by Albrecht Dreß <albrecht.dress at arcor.de>
 
    pinentry-gtk-2 is a pinentry application for the Gtk+-2 widget set.
    It tries to follow the Gnome Human Interface Guide as close as
@@ -498,6 +498,20 @@ create_window (pinentry_t ctx)
 
       entry = gtk_entry_new ();
       gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
+      /* Allow the user to set a narrower invisible character than the
+         large dot currently used by GTK.  Examples are "•★Ⓐ" */
+      if (pinentry->invisible_char)
+        {
+          gunichar *uch;
+          /*""*/
+          uch = g_utf8_to_ucs4 (pinentry->invisible_char, -1, NULL, NULL, NULL);
+          if (uch)
+            {
+              gtk_entry_set_invisible_char (GTK_ENTRY (entry), *uch);
+              g_free (uch);
+            }
+        }
+
       gtk_widget_set_size_request (entry, 200, -1);
       g_signal_connect (G_OBJECT (entry), "changed",
                         G_CALLBACK (changed_text_handler), entry);
diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
index 21f8f79..ef2b1fb 100644
--- a/pinentry/pinentry.c
+++ b/pinentry/pinentry.c
@@ -95,6 +95,9 @@ pinentry_reset (int use_defaults)
 
   int timout = pinentry.timeout;
 
+  char *invisible_char = pinentry.invisible_char;
+
+
   /* Free any allocated memory.  */
   if (use_defaults)
     {
@@ -127,6 +130,11 @@ pinentry_reset (int use_defaults)
   /* Reset the pinentry structure.  */
   memset (&pinentry, 0, sizeof (pinentry));
 
+  /* Restore options without a default we want to preserve.  */
+  pinentry.invisible_char = invisible_char;
+
+  /* Restore other options or set defaults.  */
+
   if (use_defaults)
     {
       /* Pinentry timeout in seconds.  */
@@ -878,6 +886,14 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
       return gpg_error (GPG_ERR_NOT_SUPPORTED);
 #endif
     }
+  else if (!strcmp (key, "invisible-char"))
+    {
+      if (pinentry.invisible_char)
+        free (pinentry.invisible_char);
+      pinentry.invisible_char = strdup (value);
+      if (!pinentry.invisible_char)
+	return gpg_error_from_syserror ();
+    }
   else
     return gpg_error (GPG_ERR_UNKNOWN_OPTION);
   return 0;
diff --git a/pinentry/pinentry.h b/pinentry/pinentry.h
index e154ac5..47a5567 100644
--- a/pinentry/pinentry.h
+++ b/pinentry/pinentry.h
@@ -193,6 +193,11 @@ struct pinentry
      to save the assuan ctx.  */
   void *ctx_assuan;
 
+  /* An UTF-8 string with an invisible character used to override the
+     default in some pinentries.  Only the first character is
+     used.  */
+  char *invisible_char;
+
 };
 typedef struct pinentry *pinentry_t;
 

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

Summary of changes:
 gtk+-2/pinentry-gtk-2.c | 16 +++++++++++++++-
 pinentry/pinentry.c     | 16 ++++++++++++++++
 pinentry/pinentry.h     |  5 +++++
 3 files changed, 36 insertions(+), 1 deletion(-)


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




More information about the Gnupg-commits mailing list