[git] Pinentry - branch, master, updated. pinentry-1.0.0-37-g8ea3a6c

by Werner Koch cvs at cvs.gnupg.org
Tue Nov 21 16:47:58 CET 2017


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  8ea3a6c3f8e72ebece2af9b1b05ea1da4865a786 (commit)
      from  622f876784239c9524a598e6486181bcd0ee64b2 (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 8ea3a6c3f8e72ebece2af9b1b05ea1da4865a786
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Nov 21 16:42:47 2017 +0100

    w32: Allow building for Windows again.
    
    * pinentry/pinentry.c [W32]: Do not include utsname.h
    (WITH_UTF8_CONVERSION): New macro.
    (lc_ctype_unknown_warning): Move that var to the top and define only
    if needed.
    (pinentry_utf8_to_local, pinentry_local_to_utf8): Simplyfy by using
    the new macro.
    (get_cmdline) [W32]: Do not build.
    (get_pid_name_for_uid) [W32]: Do not build.
    (pinentry_get_title) [W32]: Do not use the new utsname code.
    (option_handler) <debug-wait>: Ignore for any Windows version.
    --
    
    Also remove a couple of warnings.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/pinentry/password-cache.c b/pinentry/password-cache.c
index 0da17b5..f9523b1 100644
--- a/pinentry/password-cache.c
+++ b/pinentry/password-cache.c
@@ -139,6 +139,7 @@ password_cache_lookup (const char *keygrip, int *fatal_error)
   return password2;
 #else
   (void) keygrip;
+  (void) fatal_error;
   return NULL;
 #endif
 }
diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c
index 17b994d..30c333b 100644
--- a/pinentry/pinentry.c
+++ b/pinentry/pinentry.c
@@ -29,7 +29,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <assert.h>
-#include <sys/utsname.h>
+#ifndef HAVE_W32_SYSTEM
+# include <sys/utsname.h>
+#endif
 #ifndef HAVE_W32CE_SYSTEM
 # include <locale.h>
 #endif
@@ -41,8 +43,10 @@
 # include <windows.h>
 #endif
 
+#undef WITH_UTF8_CONVERSION
 #if defined FALLBACK_CURSES || defined PINENTRY_CURSES || defined PINENTRY_GTK
-#include <iconv.h>
+# include <iconv.h>
+# define WITH_UTF8_CONVERSION 1
 #endif
 
 #include <assuan.h>
@@ -80,6 +84,11 @@ static const char *flavor_flag;
  * parser.  */
 static char *remember_display;
 
+/* Flag to remember whether a warning has been printed.  */
+#ifdef WITH_UTF8_CONVERSION
+static int lc_ctype_unknown_warning;
+#endif
+
 
 static void
 pinentry_reset (int use_defaults)
@@ -229,9 +238,7 @@ pinentry_assuan_reset_handler (assuan_context_t ctx, char *line)
 
 
 

-static int lc_ctype_unknown_warning = 0;
-
-#if defined FALLBACK_CURSES || defined PINENTRY_CURSES || defined PINENTRY_GTK
+#ifdef WITH_UTF8_CONVERSION
 char *
 pinentry_utf8_to_local (const char *lc_ctype, const char *text)
 {
@@ -294,10 +301,13 @@ pinentry_utf8_to_local (const char *lc_ctype, const char *text)
     }
   return output_buf;
 }
+#endif /*WITH_UTF8_CONVERSION*/
+
 
 /* Convert TEXT which is encoded according to LC_CTYPE to UTF-8.  With
    SECURE set to true, use secure memory for the returned buffer.
    Return NULL on error. */
+#ifdef WITH_UTF8_CONVERSION
 char *
 pinentry_local_to_utf8 (char *lc_ctype, char *text, int secure)
 {
@@ -369,7 +379,7 @@ pinentry_local_to_utf8 (char *lc_ctype, char *text, int secure)
     }
   return output_buf;
 }
-#endif
+#endif /*WITH_UTF8_CONVERSION*/
 
 
 /* Copy TEXT or TEXTLEN to BUFFER and escape as required.  Return a
@@ -399,6 +409,10 @@ copy_and_escape (char *buffer, const void *text, size_t textlen)
 }
 
 
+
+/* Return a malloced copy of the commandline for PID.  If this is not
+ * possible NULL is returned.  */
+#ifndef HAVE_W32_SYSTEM
 static char *
 get_cmdline (unsigned long pid)
 {
@@ -432,16 +446,18 @@ get_cmdline (unsigned long pid)
 
   return strdup (buffer);
 }
+#endif /*!HAVE_W32_SYSTEM*/
 
 
 /* Atomically ask the kernel for information about process PID.
  * Return a malloc'ed copy of the process name as long as the process
  * uid matches UID.  If it cannot determine that the process has uid
  * UID, it returns NULL.
-
+ *
  * This is not as informative as get_cmdline, but it verifies that the
  * process does belong to the user in question.
  */
+#ifndef HAVE_W32_SYSTEM
 static char *
 get_pid_name_for_uid (unsigned long pid, int uid)
 {
@@ -466,6 +482,8 @@ get_pid_name_for_uid (unsigned long pid, int uid)
   fclose (fp);
   if (n == 0)
     return NULL;
+  /* Fixme: Is it specified that "Name" is always the first line?  For
+   * robustness I would prefer to have a real parser here. -wk  */
   if (strncmp (buffer, "Name:\t", 6))
     return NULL;
   end = strcspn (buffer + 6, "\n") + 6;
@@ -480,6 +498,7 @@ get_pid_name_for_uid (unsigned long pid, int uid)
 
   return strdup (buffer + 6);
 }
+#endif /*!HAVE_W32_SYSTEM*/
 
 
 /* Return a malloced string with the title.  The caller mus free the
@@ -492,6 +511,7 @@ pinentry_get_title (pinentry_t pe)
 
   if (pe->title)
     title = strdup (pe->title);
+#ifndef HAVE_W32_SYSTEM
   else if (pe->owner_pid)
     {
       char buf[200];
@@ -522,6 +542,7 @@ pinentry_get_title (pinentry_t pe)
       free (cmdline);
       title = strdup (buf);
     }
+#endif /*!HAVE_W32_SYSTEM*/
   else
     title = strdup (this_pgmname);
 
@@ -1024,7 +1045,7 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
     pinentry.grab = 1;
   else if (!strcmp (key, "debug-wait"))
     {
-#ifndef HAVE_W32CE_SYSTEM
+#ifndef HAVE_W32_SYSTEM
       fprintf (stderr, "%s: waiting for debugger - my pid is %u ...\n",
 	       this_pgmname, (unsigned int) getpid());
       sleep (*value?atoi (value):5);

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

Summary of changes:
 pinentry/password-cache.c |  1 +
 pinentry/pinentry.c       | 37 +++++++++++++++++++++++++++++--------
 2 files changed, 30 insertions(+), 8 deletions(-)


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




More information about the Gnupg-commits mailing list