[git] GnuPG - branch, master, updated. gnupg-2.1.0beta3-345-g57d26f3

by Werner Koch cvs at cvs.gnupg.org
Mon Mar 10 16:10:43 CET 2014


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  57d26f39afb3c75e24a8d240d7af32b9d2b9775a (commit)
       via  9ab9f414fb919f0bc87c301c3e36180715d0aa4e (commit)
       via  8e9b1aa563040e272840a2e5df73971a1f03401d (commit)
      from  b278043a8f38e2706ccf617d2ac5661b33791d6b (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 57d26f39afb3c75e24a8d240d7af32b9d2b9775a
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Mar 7 09:46:44 2014 +0100

    Backport useful code from fixes for bug 1447.
    
    * configure.ac: Cehck for inet_ntop.
    * m4/libcurl.m4: Provide a #define for the version of the curl
    library.
    --
    
    We do not have keyserver helpers anymore but this fixes may come handy
    eventually.

diff --git a/configure.ac b/configure.ac
index 6cb7e11..4b12f01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1303,7 +1303,7 @@ AC_FUNC_VPRINTF
 AC_FUNC_FORK
 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
-AC_CHECK_FUNCS([unsetenv fcntl ftruncate canonicalize_file_name])
+AC_CHECK_FUNCS([unsetenv fcntl ftruncate inet_ntop canonicalize_file_name])
 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
diff --git a/m4/libcurl.m4 b/m4/libcurl.m4
index f6a631b..49caecc 100644
--- a/m4/libcurl.m4
+++ b/m4/libcurl.m4
@@ -65,6 +65,10 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG],
      AC_PROG_AWK
 
      _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
+     # More recent versions of curl-config have a direct --vernum
+     # option, but we'd like this code to work with older versions as
+     # well, so just convert --version.
+     _libcurl_vernum_parse="eval $AWK '{printf \"0x%06X\",\$NF}'"
 
      _libcurl_try_link=yes
 
@@ -188,6 +192,11 @@ x=CURLOPT_VERBOSE;
            AC_SUBST(LIBCURL_CPPFLAGS)
            AC_SUBST(LIBCURL)
 
+           _libcurl_vernum=`echo $_libcurl_version | $_libcurl_vernum_parse`
+
+           AC_DEFINE_UNQUOTED(LIBCURL_VERNUM, $_libcurl_vernum,
+                  [The version of the libcurl library in packed hex form])
+
            for _libcurl_feature in $_libcurl_features ; do
 	      AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
 	      eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
@@ -228,6 +237,7 @@ x=CURLOPT_VERBOSE;
      unset _libcurl_protocol
      unset _libcurl_protocols
      unset _libcurl_version
+     unset _libcurl_vernum
      unset _libcurl_ldflags
   fi
 

commit 9ab9f414fb919f0bc87c301c3e36180715d0aa4e
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Mar 7 09:46:44 2014 +0100

    scd: acquire lock in new_reader_slot.
    
    * scd/apdu.c (new_reader_slot): Acquire lock.
    (open_ct_reader, open_pcsc_reader_direct, open_pcsc_reader_wrapped)
    (open_ccid_reader, open_rapdu_reader): Release lock.
    (lock_slot, trylock_slot, unlock_slot): Move more to the top.
    
    --
    Fixes a test case of:
       No libpcsclite1 installed.
       Run gpg-agent
       Run command "gpg-connect-agent learn /bye" with no card/token
       Sometimes it fails: ERR 100663356 Not supported <SCD>
       While it should be always: ERR 100663404 Card error <SCD>
    
    (cherry picked from commit 4f557cb9c2ebe274d6aacc60a09cd919055d01ed)
    
    Resolved conflicts:
    	scd/apdu.c: pth/npth changes. Move lock helpers to the top.
                        Take care of removed pcsc_no_service.

diff --git a/scd/apdu.c b/scd/apdu.c
index fc37fcf..c7d4735 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -373,9 +373,56 @@ static int pcsc_pinpad_modify (int slot, int class, int ins, int p0, int p1,
       Helper
  */
 
+static int
+lock_slot (int slot)
+{
+#ifdef USE_NPTH
+  int err;
+
+  err = npth_mutex_lock (&reader_table[slot].lock);
+  if (err)
+    {
+      log_error ("failed to acquire apdu lock: %s\n", strerror (err));
+      return SW_HOST_LOCKING_FAILED;
+    }
+#endif /*USE_NPTH*/
+  return 0;
+}
+
+static int
+trylock_slot (int slot)
+{
+#ifdef USE_NPTH
+  int err;
+
+  err = npth_mutex_trylock (&reader_table[slot].lock);
+  if (err == EBUSY)
+    return SW_HOST_BUSY;
+  else if (err)
+    {
+      log_error ("failed to acquire apdu lock: %s\n", strerror (err));
+      return SW_HOST_LOCKING_FAILED;
+    }
+#endif /*USE_NPTH*/
+  return 0;
+}
+
+static void
+unlock_slot (int slot)
+{
+#ifdef USE_NPTH
+  int err;
+
+  err = npth_mutex_unlock (&reader_table[slot].lock);
+  if (err)
+    log_error ("failed to release apdu lock: %s\n", strerror (errno));
+#endif /*USE_NPTH*/
+}
+
 
 /* Find an unused reader slot for PORTSTR and put it into the reader
-   table.  Return -1 on error or the index into the reader table. */
+   table.  Return -1 on error or the index into the reader table.
+   Acquire slot's lock on successful return.  Caller needs to unlock it.  */
 static int
 new_reader_slot (void)
 {
@@ -404,6 +451,11 @@ new_reader_slot (void)
       reader_table[reader].lock_initialized = 1;
     }
 #endif /*USE_NPTH*/
+  if (lock_slot (reader))
+    {
+      log_error ("error locking mutex: %s\n", strerror (errno));
+      return -1;
+    }
   reader_table[reader].connect_card = NULL;
   reader_table[reader].disconnect_card = NULL;
   reader_table[reader].close_reader = NULL;
@@ -692,6 +744,7 @@ open_ct_reader (int port)
       log_error ("apdu_open_ct_reader failed on port %d: %s\n",
                  port, ct_error_string (rc));
       reader_table[reader].used = 0;
+      unlock_slot (reader);
       return -1;
     }
 
@@ -713,6 +766,7 @@ open_ct_reader (int port)
   reader_table[reader].pinpad_modify = NULL;
 
   dump_reader_status (reader);
+  unlock_slot (reader);
   return reader;
 }
 
@@ -1871,6 +1925,7 @@ open_pcsc_reader_direct (const char *portstr)
       log_error ("pcsc_establish_context failed: %s (0x%lx)\n",
                  pcsc_error_string (err), err);
       reader_table[slot].used = 0;
+      unlock_slot (slot);
       return -1;
     }
 
@@ -1884,6 +1939,7 @@ open_pcsc_reader_direct (const char *portstr)
           log_error ("error allocating memory for reader list\n");
           pcsc_release_context (reader_table[slot].pcsc.context);
           reader_table[slot].used = 0;
+	  unlock_slot (slot);
           return -1 /*SW_HOST_OUT_OF_CORE*/;
         }
       err = pcsc_list_readers (reader_table[slot].pcsc.context,
@@ -1896,6 +1952,7 @@ open_pcsc_reader_direct (const char *portstr)
       pcsc_release_context (reader_table[slot].pcsc.context);
       reader_table[slot].used = 0;
       xfree (list);
+      unlock_slot (slot);
       return -1;
     }
 
@@ -1921,6 +1978,7 @@ open_pcsc_reader_direct (const char *portstr)
       log_error ("error allocating memory for reader name\n");
       pcsc_release_context (reader_table[slot].pcsc.context);
       reader_table[slot].used = 0;
+      unlock_slot (slot);
       return -1;
     }
   strcpy (reader_table[slot].rdrname, portstr? portstr : list);
@@ -1940,6 +1998,7 @@ open_pcsc_reader_direct (const char *portstr)
   reader_table[slot].dump_status_reader = dump_pcsc_reader_status;
 
   dump_reader_status (slot);
+  unlock_slot (slot);
   return slot;
 }
 #endif /*!NEED_PCSC_WRAPPER */
@@ -1986,6 +2045,7 @@ open_pcsc_reader_wrapped (const char *portstr)
     {
       log_error ("error creating a pipe: %s\n", strerror (errno));
       slotp->used = 0;
+      unlock_slot (slot);
       return -1;
     }
   if (pipe (wp) == -1)
@@ -1994,6 +2054,7 @@ open_pcsc_reader_wrapped (const char *portstr)
       close (rp[0]);
       close (rp[1]);
       slotp->used = 0;
+      unlock_slot (slot);
       return -1;
     }
 
@@ -2006,6 +2067,7 @@ open_pcsc_reader_wrapped (const char *portstr)
       close (wp[0]);
       close (wp[1]);
       slotp->used = 0;
+      unlock_slot (slot);
       return -1;
     }
   slotp->pcsc.pid = pid;
@@ -2142,6 +2204,7 @@ open_pcsc_reader_wrapped (const char *portstr)
   pcsc_get_status (slot, &dummy_status);
 
   dump_reader_status (slot);
+  unlock_slot (slot);
   return slot;
 
  command_failed:
@@ -2153,6 +2216,7 @@ open_pcsc_reader_wrapped (const char *portstr)
     kill (slotp->pcsc.pid, SIGTERM);
   slotp->pcsc.pid = (pid_t)(-1);
   slotp->used = 0;
+  unlock_slot (slot);
   /* There is no way to return SW. */
   return -1;
 
@@ -2541,6 +2605,7 @@ open_ccid_reader (const char *portstr)
   if (err)
     {
       slotp->used = 0;
+      unlock_slot (slot);
       return -1;
     }
 
@@ -2575,6 +2640,7 @@ open_ccid_reader (const char *portstr)
   reader_table[slot].is_t0 = 0;
 
   dump_reader_status (slot);
+  unlock_slot (slot);
   return slot;
 }
 
@@ -2813,6 +2879,7 @@ open_rapdu_reader (int portno,
   if (!slotp->rapdu.handle)
     {
       slotp->used = 0;
+      unlock_slot (slot);
       return -1;
     }
 
@@ -2867,12 +2934,14 @@ open_rapdu_reader (int portno,
 
   dump_reader_status (slot);
   rapdu_msg_release (msg);
+  unlock_slot (slot);
   return slot;
 
  failure:
   rapdu_msg_release (msg);
   rapdu_release (slotp->rapdu.handle);
   slotp->used = 0;
+  unlock_slot (slot);
   return -1;
 }
 
@@ -2885,53 +2954,6 @@ open_rapdu_reader (int portno,
  */
 
 
-static int
-lock_slot (int slot)
-{
-#ifdef USE_NPTH
-  int err;
-
-  err = npth_mutex_lock (&reader_table[slot].lock);
-  if (err)
-    {
-      log_error ("failed to acquire apdu lock: %s\n", strerror (err));
-      return SW_HOST_LOCKING_FAILED;
-    }
-#endif /*USE_NPTH*/
-  return 0;
-}
-
-static int
-trylock_slot (int slot)
-{
-#ifdef USE_NPTH
-  int err;
-
-  err = npth_mutex_trylock (&reader_table[slot].lock);
-  if (err == EBUSY)
-    return SW_HOST_BUSY;
-  else if (err)
-    {
-      log_error ("failed to acquire apdu lock: %s\n", strerror (err));
-      return SW_HOST_LOCKING_FAILED;
-    }
-#endif /*USE_NPTH*/
-  return 0;
-}
-
-static void
-unlock_slot (int slot)
-{
-#ifdef USE_NPTH
-  int err;
-
-  err = npth_mutex_unlock (&reader_table[slot].lock);
-  if (err)
-    log_error ("failed to release apdu lock: %s\n", strerror (errno));
-#endif /*USE_NPTH*/
-}
-
-
 /* Open the reader and return an internal slot number or -1 on
    error. If PORTSTR is NULL we default to a suitable port (for ctAPI:
    the first USB reader.  For PC/SC the first listed reader). */

commit 8e9b1aa563040e272840a2e5df73971a1f03401d
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Nov 16 10:35:33 2012 +0100

    Comment fixes.
    
    --
    
    Reported-by: Daniel Kahn Gillmor
    (cherry picked from commit 7db5c81e3a40b60e146f29c6744a33fd1b88c090)

diff --git a/g10/sign.c b/g10/sign.c
index f5f0f95..d9f2dd3 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -421,10 +421,10 @@ match_dsa_hash (unsigned int qbytes)
 /*
   First try --digest-algo.  If that isn't set, see if the recipient
   has a preferred algorithm (which is also filtered through
-  --preferred-digest-prefs).  If we're making a signature without a
+  --personal-digest-prefs).  If we're making a signature without a
   particular recipient (i.e. signing, rather than signing+encrypting)
-  then take the first algorithm in --preferred-digest-prefs that is
-  usable for the pubkey algorithm.  If --preferred-digest-prefs isn't
+  then take the first algorithm in --personal-digest-prefs that is
+  usable for the pubkey algorithm.  If --personal-digest-prefs isn't
   set, then take the OpenPGP default (i.e. SHA-1).
 
   Note that Ed25519+EdDSA takes an input of arbitrary length and thus

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

Summary of changes:
 configure.ac  |    2 +-
 g10/sign.c    |    6 +--
 m4/libcurl.m4 |   10 +++++
 scd/apdu.c    |  118 ++++++++++++++++++++++++++++++++++-----------------------
 4 files changed, 84 insertions(+), 52 deletions(-)


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




More information about the Gnupg-commits mailing list