[git] Pinentry - branch, master, updated. pinentry-0.9.2-11-g496235a

by Neal H. Walfield cvs at cvs.gnupg.org
Wed May 13 21:47:20 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  496235af8dfd373b54e5610f86bf1cada175ac23 (commit)
       via  3062742b945f95d72001896f8ba5468b9e63aa9b (commit)
       via  bdd81974633f8e31d582b62999ef9b004bc3b95e (commit)
       via  ae7dfae00df81a683adf0292a52b63632491319e (commit)
      from  2582cb9eb23ca287520caa04a12f83f10c268f71 (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 496235af8dfd373b54e5610f86bf1cada175ac23
Author: Neal H. Walfield <neal at gnu.org>
Date:   Wed May 13 21:47:11 2015 +0200

    Fix linking order to work when linked with --as-needed.
    
    * curses/Makefile.am (LDADD): Add $(COMMON_LIBS) after all of the
    local objects and object archives.
    * gnome3/Makefile.am (LDADD): Likewise.
    * gtk+-2/Makefile.am (LDADD): Likewise.
    * qt4/Makefile.am (pinentry_qt4_LDADD): Likewise.
    * tty/Makefile.am (LDADD): Likewise.
    
    Reported-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>

diff --git a/curses/Makefile.am b/curses/Makefile.am
index e8ea031..4d764c7 100644
--- a/curses/Makefile.am
+++ b/curses/Makefile.am
@@ -22,9 +22,8 @@
 bin_PROGRAMS = pinentry-curses
 
 AM_CPPFLAGS = $(COMMON_CFLAGS) $(NCURSES_INCLUDE) -I$(top_srcdir)/pinentry
-LDADD = $(COMMON_LIBS) \
-	../pinentry/libpinentry.a ../pinentry/libpinentry-curses.a \
+LDADD = ../pinentry/libpinentry.a ../pinentry/libpinentry-curses.a \
 	../assuan/libassuan.a ../secmem/libsecmem.a \
-	$(LIBCAP) $(LIBCURSES) $(LIBICONV)
+	$(COMMON_LIBS) $(LIBCAP) $(LIBCURSES) $(LIBICONV)
 
 pinentry_curses_SOURCES = pinentry-curses.c
diff --git a/gnome3/Makefile.am b/gnome3/Makefile.am
index 78df706..46639de 100644
--- a/gnome3/Makefile.am
+++ b/gnome3/Makefile.am
@@ -32,8 +32,7 @@ endif
 AM_CPPFLAGS = $(COMMON_CFLAGS) $(GNOME3CFLAGS) \
 	$(ncurses_include) -I$(top_srcdir)/assuan \
 	-I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
-LDADD = $(COMMON_LIBS) \
-	../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
-	$(LIBCAP) $(GNOME3LIBS) $(libcurses)
+LDADD = ../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
+	$(COMMON_LIBS) $(LIBCAP) $(GNOME3LIBS) $(libcurses)
 
 pinentry_gnome3_SOURCES = pinentry-gnome3.c
diff --git a/gtk+-2/Makefile.am b/gtk+-2/Makefile.am
index c98139f..7e37469 100644
--- a/gtk+-2/Makefile.am
+++ b/gtk+-2/Makefile.am
@@ -31,9 +31,8 @@ endif
 
 AM_CPPFLAGS = $(COMMON_CFLAGS) $(GTK2CFLAGS) $(ncurses_include) \
 	-I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
-LDADD = $(COMMON_LIBS) \
-	../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
-	$(LIBCAP) $(GTK2LIBS) $(libcurses)
+LDADD = ../pinentry/libpinentry.a ../assuan/libassuan.a ../secmem/libsecmem.a \
+	$(COMMON_LIBS) $(LIBCAP) $(GTK2LIBS) $(libcurses)
 
 pinentry_gtk_2_SOURCES = pinentry-gtk-2.c \
 	gtksecentry.c gtksecentry.h gseal-gtk-compat.h
diff --git a/qt4/Makefile.am b/qt4/Makefile.am
index 31274bb..816aade 100644
--- a/qt4/Makefile.am
+++ b/qt4/Makefile.am
@@ -38,10 +38,10 @@ AM_CPPFLAGS = $(COMMON_CFLAGS) \
 	-I$(top_srcdir) -I$(top_srcdir)/assuan -I$(top_srcdir)/secmem \
 	$(ncurses_include) -I$(top_srcdir)/pinentry
 AM_CXXFLAGS = $(QT4_CORE_CFLAGS) $(QT4_GUI_CFLAGS)
-pinentry_qt4_LDADD = $(COMMON_LIBS) \
-	$(QT4_CORE_LIBS) $(QT4_GUI_LIBS) $(libcurses) \
+pinentry_qt4_LDADD = \
 	../pinentry/libpinentry.a $(top_builddir)/assuan/libassuan.a \
-	$(top_builddir)/secmem/libsecmem.a $(LIBCAP)
+	$(top_builddir)/secmem/libsecmem.a \
+	$(COMMON_LIBS) $(QT4_CORE_LIBS) $(QT4_GUI_LIBS) $(libcurses) $(LIBCAP)
 
 BUILT_SOURCES = \
 	pinentryconfirm.moc qsecurelineedit.moc pinentrydialog.moc
diff --git a/tty/Makefile.am b/tty/Makefile.am
index 798c08f..aa805b2 100644
--- a/tty/Makefile.am
+++ b/tty/Makefile.am
@@ -21,8 +21,8 @@
 bin_PROGRAMS = pinentry-tty
 
 AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(top_srcdir)/pinentry
-LDADD = $(COMMON_LIBS) ../pinentry/libpinentry.a \
+LDADD = ../pinentry/libpinentry.a \
 	../assuan/libassuan.a ../secmem/libsecmem.a \
-	$(LIBCAP) $(LIBICONV)
+	$(COMMON_LIBS) $(LIBCAP) $(LIBICONV)
 
 pinentry_tty_SOURCES = pinentry-tty.c

commit 3062742b945f95d72001896f8ba5468b9e63aa9b
Author: Neal H. Walfield <neal at gnu.org>
Date:   Wed May 13 14:20:23 2015 +0200

    Don't interpret the handler's return value as the passphrase's length.
    
    * pinentry/pinentry.c (cmd_getpin): Don't interpret the return value
    as the passphrase length.  Use strlen instead.

diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
index 53216fc..836ee14 100644
--- a/pinentry/pinentry.c
+++ b/pinentry/pinentry.c
@@ -1109,7 +1109,7 @@ cmd_getpin (ASSUAN_CONTEXT ctx, char *line)
     {
       if (pinentry.repeat_okay)
         assuan_write_status (ctx, "PIN_REPEATED", "");
-      result = assuan_send_data (ctx, pinentry.pin, result);
+      result = assuan_send_data (ctx, pinentry.pin, strlen(pinentry.pin));
       if (!result)
 	result = assuan_send_data (ctx, NULL, 0);
 

commit bdd81974633f8e31d582b62999ef9b004bc3b95e
Author: Neal H. Walfield <neal at gnu.org>
Date:   Wed May 13 13:52:03 2015 +0200

    Make the management of pinentry.pin more explicit.
    
    * pinentry/pinentry.c: Include <assert.h>.
    (pinentry): Set pin_len to 0.
    (pinentry_setbufferlen): If len is less than 2048, set it to 2048.
    Add an assertion.
    (pinentry_setbuffer_clear): New function that releases the pin buffer.
    (pinentry_setbuffer_init): New function that initializes the pin
    buffer.
    (cmd_getpin): Use pinentry_setbuffer_init and pinentry_setbuffer_clear
    instead of manual memory management.
    (cmd_confirm): Use pinentry_setbuffer_clear instead of manual memory
    management.

diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
index 3a44851..53216fc 100644
--- a/pinentry/pinentry.c
+++ b/pinentry/pinentry.c
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <assert.h>
 #ifndef HAVE_W32CE_SYSTEM
 # include <locale.h>
 #endif
@@ -67,7 +68,7 @@ struct pinentry pinentry =
     NULL,	/* Not-Ok button.  */
     NULL,	/* Cancel button.  */
     NULL,	/* PIN.  */
-    2048,	/* PIN length.  */
+    0,		/* PIN length.  */
     0,          /* pin_from_cache.  */
     0,		/* Display.  */
     0,		/* TTY name.  */
@@ -354,8 +355,18 @@ char *
 pinentry_setbufferlen (pinentry_t pin, int len)
 {
   char *newp;
-  if (len < pinentry.pin_len)
+
+  if (pin->pin_len)
+    assert (pin->pin);
+  else
+    assert (!pin->pin);
+
+  if (len < 2048)
+    len = 2048;
+
+  if (len <= pin->pin_len)
     return NULL;
+
   newp = secmem_realloc (pin->pin, len);
   if (newp)
     {
@@ -371,6 +382,28 @@ pinentry_setbufferlen (pinentry_t pin, int len)
   return newp;
 }
 
+static void
+pinentry_setbuffer_clear (pinentry_t pin)
+{
+  if (! pin->pin)
+    {
+      assert (pin->pin_len == 0);
+      return;
+    }
+
+  assert (pin->pin_len > 0);
+
+  secmem_free (pin->pin);
+  pin->pin = NULL;
+  pin->pin_len = 0;
+}
+
+static void
+pinentry_setbuffer_init (pinentry_t pin)
+{
+  pinentry_setbuffer_clear (pin);
+  pinentry_setbufferlen (pin, 0);
+}
 
 /* Initialize the secure memory subsystem, drop privileges and return.
    Must be called early. */
@@ -983,7 +1016,7 @@ cmd_getpin (ASSUAN_CONTEXT ctx, char *line)
   int set_prompt = 0;
   int just_read_password_from_cache = 0;
 
-  pinentry.pin = secmem_malloc (pinentry.pin_len);
+  pinentry_setbuffer_init (&pinentry);
   if (!pinentry.pin)
     return ASSUAN_Out_Of_Core;
 
@@ -1065,11 +1098,7 @@ cmd_getpin (ASSUAN_CONTEXT ctx, char *line)
 
   if (result < 0)
     {
-      if (pinentry.pin)
-	{
-	  secmem_free (pinentry.pin);
-	  pinentry.pin = NULL;
-	}
+      pinentry_setbuffer_clear (&pinentry);
       if (pinentry.specific_err)
         return pinentry.specific_err;
       return pinentry.locale_err? ASSUAN_Locale_Problem: ASSUAN_Canceled;
@@ -1094,11 +1123,7 @@ cmd_getpin (ASSUAN_CONTEXT ctx, char *line)
 	password_cache_save (pinentry.keyinfo, pinentry.pin);
     }
 
-  if (pinentry.pin)
-    {
-      secmem_free (pinentry.pin);
-      pinentry.pin = NULL;
-    }
+  pinentry_setbuffer_clear (&pinentry);
 
   return result;
 }
@@ -1122,6 +1147,7 @@ cmd_confirm (ASSUAN_CONTEXT ctx, char *line)
   pinentry.locale_err = 0;
   pinentry.specific_err = 0;
   pinentry.canceled = 0;
+  pinentry_setbuffer_clear (&pinentry);
   result = (*pinentry_cmd_handler) (&pinentry);
   if (pinentry.error)
     {

commit ae7dfae00df81a683adf0292a52b63632491319e
Author: Neal H. Walfield <neal at gnu.org>
Date:   Wed May 13 14:21:19 2015 +0200

    Better document struct pinentry.
    
    * pinentry/pinentry.h (struct pinentry): Better document the various
    fields.

diff --git a/pinentry/pinentry.h b/pinentry/pinentry.h
index 2fd267e..7112637 100644
--- a/pinentry/pinentry.h
+++ b/pinentry/pinentry.h
@@ -39,20 +39,28 @@ typedef enum {
 
 struct pinentry
 {
-  /* The window title, or NULL.  */
+  /* The window title, or NULL.  (Assuan: "SETTITLE TITLE".)  */
   char *title;
-  /* The description to display, or NULL.  */
+  /* The description to display, or NULL.  (Assuan: "SETDESC
+     DESC".) */
   char *description;
-  /* The error message to display, or NULL.  */
+  /* The error message to display, or NULL.  (Assuan: "SETERROR
+     MESSAGE".) */
   char *error;
-  /* The prompt to display, or NULL.  */
+  /* The prompt to display, or NULL.  (Assuan: "SETPROMPT
+     prompt".)  */
   char *prompt;
-  /* The OK button text to display, or NULL.  */
+  /* The OK button text to display, or NULL.  (Assuan: "SETOK
+     OK".)  */
   char *ok;
-  /* The Not-OK button text to display, or NULL.  */
+  /* The Not-OK button text to display, or NULL.  This is the text for
+     the alternative option shown by the third button.  (Assuan:
+     "SETNOTOK NOTOK".)  */
   char *notok;
-  /* The Cancel button text to display, or NULL.  */
+  /* The Cancel button text to display, or NULL.  (Assuan: "SETCANCEL
+     CANCEL".)  */
   char *cancel;
+
   /* The buffer to store the secret into.  */
   char *pin;
   /* The length of the buffer.  */
@@ -61,15 +69,19 @@ struct pinentry
      the user (0). */
   int pin_from_cache;
 
-  /* The name of the X display to use if X is available and supported.  */
+  /* The name of the X display to use if X is available and supported.
+     (Assuan: "OPTION display DISPLAY".)  */
   char *display;
-  /* The name of the terminal node to open if X not available or supported.  */
+  /* The name of the terminal node to open if X not available or
+     supported.  (Assuan: "OPTION ttyname TTYNAME".)  */
   char *ttyname;
-  /* The type of the terminal.  */
+  /* The type of the terminal.  (Assuan: "OPTION ttytype TTYTYPE".)  */
   char *ttytype;
-  /* The LC_CTYPE value for the terminal.  */
+  /* The LC_CTYPE value for the terminal.  (Assuan: "OPTION lc-ctype
+     LC_CTYPE".)  */
   char *lc_ctype;
-  /* The LC_MESSAGES value for the terminal.  */
+  /* The LC_MESSAGES value for the terminal.  (Assuan: "OPTION
+     lc-messages LC_MESSAGES".)  */
   char *lc_messages;
 
   /* True if debug mode is requested.  */
@@ -83,35 +95,38 @@ struct pinentry
   int enhanced;
 #endif
 
-  /* True if caller should grab the keyboard.  */
+  /* True if caller should grab the keyboard.  (Assuan: "OPTION grab"
+     or "OPTION no-grab".)  */
   int grab;
   /* The window ID of the parent window over which the pinentry window
-     should be displayed.  */
+     should be displayed.  (Assuan: "OPTION parent-wid WID".)  */
   int parent_wid;
 
   /* The name of an optional file which will be touched after a curses
-     entry has been displayed.  */
+     entry has been displayed.  (Assuan: "OPTION touch-file
+     FILENAME".)  */
   char *touch_file;
 
-  /* The user should set this to -1 if the user canceled the request,
-     and to the length of the PIN stored in pin otherwise.  */
+  /* The frontend should set this to -1 if the user canceled the
+     request, and to the length of the PIN stored in pin
+     otherwise.  */
   int result;
 
-  /* The user should set this if the NOTOK button was pressed.  */
+  /* The frontend should set this if the NOTOK button was pressed.  */
   int canceled;
 
-  /* The user should set this to true if an error with the local
+  /* The frontend should set this to true if an error with the local
      conversion occured. */
   int locale_err;
 
-  /* The user should set this to an gpg-error so that commands are
-     abale to return specific error codes.  This is an ugly hack due
-     to the fact that pinentry_cmd_handler_t return the length of the
-     passphrase or an negative error code.  */
+  /* The frontend should set this to a gpg-error so that commands are
+     able to return specific error codes.  This is an ugly hack due to
+     the fact that pinentry_cmd_handler_t returns the length of the
+     passphrase or a negative error code.  */
   int specific_err;
 
-  /* The user should set this to true if the window close button has
-     been used.  This flag is used in addition to a regular return
+  /* The frontend should set this to true if the window close button
+     has been used.  This flag is used in addition to a regular return
      value.  */
   int close_button;
 
@@ -122,10 +137,11 @@ struct pinentry
 
   /* If true a second prompt for the passphrase is shown and the user
      is expected to enter the same passphrase again.  Pinentry checks
-     that both match.  */
+     that both match.  (Assuan: "SETREPEAT".)  */
   char *repeat_passphrase;
 
-  /* The string to show if a repeated passphrase does not match.  */
+  /* The string to show if a repeated passphrase does not match.
+     (Assuan: "SETREPEATERROR ERROR".)  */
   char *repeat_error_string;
 
   /* Set to true if the passphrase has been entered a second time and
@@ -135,10 +151,12 @@ struct pinentry
   /* If this is not NULL, a passphrase quality indicator is shown.
      There will also be an inquiry back to the caller to get an
      indication of the quality for the passphrase entered so far.  The
-     string is used as a label for the quality bar.  */
+     string is used as a label for the quality bar.  (Assuan:
+     "SETQUALITYBAR LABEL".)  */
   char *quality_bar;
 
-  /* The tooltip to be show for the qualitybar.  Malloced or NULL.  */
+  /* The tooltip to be show for the qualitybar.  Malloced or NULL.
+     (Assuan: "SETQUALITYBAR_TT TOOLTIP".)  */
   char *quality_bar_tt;
 
   /* For the curses pinentry, the color of error messages.  */
@@ -151,19 +169,25 @@ struct pinentry
   /* Malloced and i18ned default strings or NULL.  These strings may
      include an underscore character to indicate an accelerator key.
      A double underscore represents a plain one.  */
+  /* (Assuan: "OPTION default-ok OK").  */
   char *default_ok;
+  /* (Assuan: "OPTION default-cancel CANCEL").  */
   char *default_cancel;
+  /* (Assuan: "OPTION default-prompt PROMPT").  */
   char *default_prompt;
+  /* (Assuan: "OPTION default-pwmngr
+     SAVE_PASSWORD_WITH_PASSWORD_MANAGER?").  */
   char *default_pwmngr;
 
   /* Whether we are allowed to read the password from an external
-     cache.  */
+     cache.  (Assuan: "OPTION allow-external-password-cache")  */
   int allow_external_password_cache;
 
   /* We only try the cache once.  */
   int tried_password_cache;
 
-  /* A stable identifier for the key.  */
+  /* A stable identifier for the key.  (Assuan: "SETKEYINFO
+     KEYINFO".)  */
   char *keyinfo;
 
   /* Whether we may cache the password (according to the user).  */

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

Summary of changes:
 curses/Makefile.am  |  5 ++--
 gnome3/Makefile.am  |  5 ++--
 gtk+-2/Makefile.am  |  5 ++--
 pinentry/pinentry.c | 54 ++++++++++++++++++++++++---------
 pinentry/pinentry.h | 86 ++++++++++++++++++++++++++++++++++-------------------
 qt4/Makefile.am     |  6 ++--
 tty/Makefile.am     |  4 +--
 7 files changed, 106 insertions(+), 59 deletions(-)


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




More information about the Gnupg-commits mailing list