[git] GnuPG - branch, master, updated. gnupg-2.1.15-281-gd1ccab5

by Werner Koch cvs at cvs.gnupg.org
Wed Oct 26 10:28:49 CEST 2016


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 GNU Privacy Guard".

The branch, master has been updated
       via  d1ccab5176d7719328b287544b54b85e0277b146 (commit)
       via  b77f95a4a675fd20f6eeb611f4e7b519eceb4ad3 (commit)
       via  ece13f177d948013b6f3df926406c0cd947abc25 (commit)
       via  21b318452abbfe21c45c2a67dae0e3a81cff1090 (commit)
      from  900c18f0b5f11cf2e9f30df5ec77ac511b533785 (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 d1ccab5176d7719328b287544b54b85e0277b146
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Oct 26 10:24:41 2016 +0200

    dirmngr: Fix hang due to deferred thread initialization.
    
    * dirmngr/dirmngr.c (main): Call ldap_wrapper_launch_thread after
    thread_init.
    --
    
    Fixes-commit: eda17649f8bd3b8ce7bfc00a3c11cbcae63c845d
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 90eb6d4..41e897b 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -983,13 +983,13 @@ main (int argc, char **argv)
           log_debug ("... okay\n");
         }
 
-#if USE_LDAP
-      ldap_wrapper_launch_thread ();
-#endif /*USE_LDAP*/
 
       thread_init ();
       cert_cache_init ();
       crl_cache_init ();
+#if USE_LDAP
+      ldap_wrapper_launch_thread ();
+#endif /*USE_LDAP*/
       start_command_handler (ASSUAN_INVALID_FD);
       shutdown_reaper ();
     }
@@ -1182,13 +1182,12 @@ main (int argc, char **argv)
         }
 #endif
 
-#if USE_LDAP
-      ldap_wrapper_launch_thread ();
-#endif /*USE_LDAP*/
-
       thread_init ();
       cert_cache_init ();
       crl_cache_init ();
+#if USE_LDAP
+      ldap_wrapper_launch_thread ();
+#endif /*USE_LDAP*/
       handle_connections (fd);
       assuan_sock_close (fd);
       shutdown_reaper ();
@@ -1211,12 +1210,12 @@ main (int argc, char **argv)
       memset (&ctrlbuf, 0, sizeof ctrlbuf);
       dirmngr_init_default_ctrl (&ctrlbuf);
 
-#if USE_LDAP
-      ldap_wrapper_launch_thread ();
-#endif /*USE_LDAP*/
       thread_init ();
       cert_cache_init ();
       crl_cache_init ();
+#if USE_LDAP
+      ldap_wrapper_launch_thread ();
+#endif /*USE_LDAP*/
       if (!argc)
         rc = crl_cache_load (&ctrlbuf, NULL);
       else
@@ -1237,12 +1236,12 @@ main (int argc, char **argv)
       memset (&ctrlbuf, 0, sizeof ctrlbuf);
       dirmngr_init_default_ctrl (&ctrlbuf);
 
-#if USE_LDAP
-      ldap_wrapper_launch_thread ();
-#endif /*USE_LDAP*/
       thread_init ();
       cert_cache_init ();
       crl_cache_init ();
+#if USE_LDAP
+      ldap_wrapper_launch_thread ();
+#endif /*USE_LDAP*/
       rc = crl_fetch (&ctrlbuf, argv[0], &reader);
       if (rc)
         log_error (_("fetching CRL from '%s' failed: %s\n"),

commit b77f95a4a675fd20f6eeb611f4e7b519eceb4ad3
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Oct 26 09:10:29 2016 +0200

    agent: Avoid double error message.
    
    * agent/gpg-agent.c (map_supervised_sockets): Shorten error message.
    Remove unneeded diagnostic.
    --
    
    get_socket_name already prints error messages and thus there is not
    need to print another one.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 8e2d012..6f73fc7 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -717,18 +717,17 @@ map_supervised_sockets (gnupg_fd_t *r_fd,
   if (!fdnames)
     {
       struct stat statbuf;
+
       if (fd_count != 1)
         log_error ("no LISTEN_FDNAMES and LISTEN_FDS (%d) != 1"
                    " in --supervised mode."
                    " (ignoring all sockets but the first one)\n",
                    fd_count);
       if (fstat (3, &statbuf) == -1 && errno ==EBADF)
-        log_fatal ("file descriptor 3 must be valid in --supervised mode (as the "
-                   "agent's standard socket) if LISTEN_FDNAMES is not set\n");
+        log_fatal ("file descriptor 3 must be valid in --supervised mode"
+                   " if LISTEN_FDNAMES is not set\n");
       *r_fd = 3;
       socket_name = get_socket_name (3);
-      if (!socket_name)
-          log_error ("cannot learn socket name for fd 3\n");
     }
   else if (fd_count != nfdnames)
     {

commit ece13f177d948013b6f3df926406c0cd947abc25
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Oct 26 09:02:10 2016 +0200

    common: Use GPG_ERR_INV_VALUE instead of GPG_ERR_EINVAL.
    
    * common/sysutils.c (gnupg_inotify_watch_socket): Return
    GPG_ERR_INV_VALUE for a missing socket name and set proper error
    source.
    --
    
    By using a different value we can easier see whether the error is due
    to a system call or from GnuPG code.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/sysutils.c b/common/sysutils.c
index ab3e1d6..3a08df7 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -988,7 +988,7 @@ gnupg_inotify_watch_socket (int *r_fd, const char *socket_name)
   *r_fd = -1;
 
   if (!socket_name)
-    return gpg_error (GPG_ERR_EINVAL);
+    return my_error (GPG_ERR_INV_VALUE);
 
   fname = xtrystrdup (socket_name);
   if (!fname)

commit 21b318452abbfe21c45c2a67dae0e3a81cff1090
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Oct 26 08:34:18 2016 +0200

    tests: Improve portability of fake-pinentry.
    
    * tests/openpgp/fake-pinentry.c: Make all functions static.
    (get_passphrase): s/unlink/remove/ because that is standard C.
    (spacep): Rename to whitespace and change all callers.
    (main): Move macro out of if-then chain.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/tests/openpgp/fake-pinentry.c b/tests/openpgp/fake-pinentry.c
index 90e086c..13dc6d9 100644
--- a/tests/openpgp/fake-pinentry.c
+++ b/tests/openpgp/fake-pinentry.c
@@ -25,9 +25,10 @@
 #include <stdarg.h>
 #include <unistd.h>
 
-FILE *log_stream;
+static FILE *log_stream;
 
-int
+
+static int
 reply (const char *fmt, ...)
 {
   int result;
@@ -48,8 +49,9 @@ reply (const char *fmt, ...)
   return result;
 }
 
+
 /* Return the first line from FNAME, removing it from the file.  */
-char *
+static char *
 get_passphrase (const char *fname)
 {
   char *passphrase = NULL;
@@ -111,7 +113,7 @@ get_passphrase (const char *fname)
 
   fclose (source);
   fclose (sink);
-  if (unlink (fname))
+  if (remove (fname))
     {
       fprintf (stderr, "Failed to remove %s: %s",
                fname, strerror (errno));
@@ -128,17 +130,19 @@ get_passphrase (const char *fname)
 }
 
 

-#define spacep(p)   (*(p) == ' ' || *(p) == '\t' \
-                     || *(p) == '\r' || *(p) == '\n')
+#define whitespacep(p)   (*(p) == ' ' || *(p) == '\t' \
+                          || *(p) == '\r' || *(p) == '\n')
 
 /* rstrip line.  */
-void
+static void
 rstrip (char *buffer)
 {
   char *p;
+  if (!*buffer)
+    return; /* This is to avoid p = buffer - 1 */
   for (p = buffer + strlen (buffer) - 1; p >= buffer; p--)
     {
-      if (! spacep (p))
+      if (! whitespacep (p))
         break;
       *p = 0;
     }
@@ -155,13 +159,13 @@ rstrip (char *buffer)
 char *
 skip_options (const char *line)
 {
-  while (spacep (line))
+  while (whitespacep (line))
     line++;
   while (*line == '-' && line[1] == '-')
     {
-      while (*line && !spacep (line))
+      while (*line && !whitespacep (line))
         line++;
-      while (spacep (line))
+      while (whitespacep (line))
         line++;
     }
   return (char*) line;
@@ -179,12 +183,12 @@ option_value (const char *line, const char *name)
   s = strstr (line, name);
   if (s && s >= skip_options (line))
     return NULL;
-  if (s && (s == line || spacep (s-1))
-      && s[n] && (spacep (s+n) || s[n] == '='))
+  if (s && (s == line || whitespacep (s-1))
+      && s[n] && (whitespacep (s+n) || s[n] == '='))
     {
       s += n + 1;
       s += strspn (s, " ");
-      if (*s && !spacep(s))
+      if (*s && !whitespacep(s))
         return s;
     }
   return NULL;
@@ -207,7 +211,7 @@ main (int argc, char **argv)
   setvbuf (stdout, NULL, _IOLBF, BUFSIZ);
 
   args = getenv ("PINENTRY_USER_DATA");
-  got_environment_user_data = args != NULL;
+  got_environment_user_data = !!args;
   if (! args)
     args = "";
 
@@ -216,7 +220,7 @@ main (int argc, char **argv)
   if (logfile)
     {
       char *p = logfile, more;
-      while (*p && ! spacep (p))
+      while (*p && ! whitespacep (p))
         p++;
       more = !! *p;
       *p = 0;
@@ -234,7 +238,7 @@ main (int argc, char **argv)
   if (passphrasefile)
     {
       char *p = passphrasefile, more;
-      while (*p && ! spacep (p))
+      while (*p && ! whitespacep (p))
         p++;
       more = !! *p;
       *p = 0;
@@ -257,13 +261,13 @@ main (int argc, char **argv)
         passphrase = "no PINENTRY_USER_DATA -- using default passphrase";
     }
 
-  reply ("# fake-pinentry(%d) started.  Passphrase='%s'.\n",
-         getpid (), passphrase);
+  reply ("# fake-pinentry(%u) started.  Passphrase='%s'.\n",
+         (unsigned int)getpid (), passphrase);
   reply ("OK - what's up?\n");
 
   while (! feof (stdin))
     {
-      char buffer[1024], *p;
+      char buffer[1024];
 
       if (fgets (buffer, sizeof buffer, stdin) == NULL)
 	break;
@@ -273,6 +277,8 @@ main (int argc, char **argv)
 
       rstrip (buffer);
 
+#define OPT_USER_DATA	"OPTION pinentry-user-data="
+
       if (strncmp (buffer, "GETPIN", 6) == 0)
         reply ("D %s\n", passphrase);
       else if (strncmp (buffer, "BYE", 3) == 0)
@@ -280,7 +286,6 @@ main (int argc, char **argv)
 	  reply ("OK\n");
 	  break;
 	}
-#define OPT_USER_DATA	"OPTION pinentry-user-data="
       else if (strncmp (buffer, OPT_USER_DATA, strlen (OPT_USER_DATA)) == 0)
         {
           if (got_environment_user_data)
@@ -300,6 +305,8 @@ main (int argc, char **argv)
       reply ("OK\n");
     }
 
+#undef OPT_USER_DATA
+
   reply ("# Connection terminated.\n");
   if (log_stream)
     fclose (log_stream);

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

Summary of changes:
 agent/gpg-agent.c             |  7 +++----
 common/sysutils.c             |  2 +-
 dirmngr/dirmngr.c             | 25 +++++++++++-----------
 tests/openpgp/fake-pinentry.c | 49 ++++++++++++++++++++++++-------------------
 4 files changed, 44 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list