[git] GnuPG - branch, master, updated. gnupg-2.1.10-66-ga9cbdcf

by Werner Koch cvs at cvs.gnupg.org
Wed Dec 23 16:34:23 CET 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 GNU Privacy Guard".

The branch, master has been updated
       via  a9cbdcfd9c364557787f4a173cc59f14c067946e (commit)
       via  363ed2e892adc97fae97111bb56b64f9f809e8d5 (commit)
       via  04c9cddda95f2a8ca5c0cf10bb3dd6accf56cf45 (commit)
       via  ef7b7e91600f35b4d682a6267001a8d30f0fa49f (commit)
       via  b0c9867fb74d5a00335e6606d5bdcc5342ce26cd (commit)
      from  aecf1a3c57ca8bf8050a3743b62fe142ccf9eb22 (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 a9cbdcfd9c364557787f4a173cc59f14c067946e
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Dec 23 15:45:20 2015 +0100

    gpg: Rename struct pubkey to pukey_s and add pubkey_t.
    
    * g10/keydb.h (struct pubkey): Rename to pubkey_s.
    (pubkey_t): New.  Change all struct pubkey_s to use this type.
    * g10/getkey.c (get_pubkeys): Rename arg keys to r_keys.
    --
    
    It is common in GnuPG to use a suffix of _s for struct names.  There
    is no technical need for this (actually this pattern comes from pre
    ANSI C compilers which had no separate namespaces) but it avoid
    surprises when reading the code.
    
    Adding the pubkey_t type is mainly to improve font locking by using
    the common suffix _t for a typedefed type.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/getkey.c b/g10/getkey.c
index 26b1932..608b75e 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -367,7 +367,7 @@ getkey_disable_caches ()
 
 
 void
-pubkey_free (struct pubkey *key)
+pubkey_free (pubkey_t key)
 {
   if (key)
     {
@@ -378,11 +378,11 @@ pubkey_free (struct pubkey *key)
 }
 
 void
-pubkeys_free (struct pubkey *keys)
+pubkeys_free (pubkey_t keys)
 {
   while (keys)
     {
-      struct pubkey *next = keys->next;
+      pubkey_t next = keys->next;
       pubkey_free (keys);
       keys = next;
     }
@@ -420,7 +420,7 @@ gpg_error_t
 get_pubkeys (ctrl_t ctrl,
              char *search_terms, int use, int include_unusable, char *source,
              int warn_possibly_ambiguous,
-             struct pubkey **keys)
+             pubkey_t *r_keys)
 {
   /* We show a warning when a key appears multiple times in the DB.
      This can happen for two reasons:
@@ -442,8 +442,8 @@ get_pubkeys (ctrl_t ctrl,
   KEYDB_SEARCH_DESC desc;
 
   GETKEY_CTX ctx;
-  struct pubkey *results = NULL;
-  struct pubkey *r;
+  pubkey_t results = NULL;
+  pubkey_t r;
 
   int count;
 
@@ -456,7 +456,7 @@ get_pubkeys (ctrl_t ctrl,
                  __func__, source ? source : "user input", search_terms);
     }
 
-  if (*keys)
+  if (*r_keys)
     log_bug ("%s: KEYS should be NULL!\n", __func__);
 
   switch (use)
@@ -571,9 +571,9 @@ get_pubkeys (ctrl_t ctrl,
   count = 0;
   for (r = results; r; r = r->next)
     {
-      struct pubkey **prevp;
-      struct pubkey *next;
-      struct pubkey *r2;
+      pubkey_t *prevp;
+      pubkey_t next;
+      pubkey_t r2;
       int dups = 0;
 
       prevp = &r->next;
@@ -639,7 +639,7 @@ get_pubkeys (ctrl_t ctrl,
         }
     }
   else
-    *keys = results;
+    *r_keys = results;
 
   return err;
 }
diff --git a/g10/keydb.h b/g10/keydb.h
index 66bfa57..f99136a 100644
--- a/g10/keydb.h
+++ b/g10/keydb.h
@@ -486,19 +486,20 @@ int get_pubkey_fast ( PKT_public_key *pk, u32 *keyid );
 KBNODE get_pubkeyblock( u32 *keyid );
 
 /* A list used by get_pubkeys to gather all of the matches.  */
-struct pubkey
+struct pubkey_s
 {
-  struct pubkey *next;
+  struct pubkey_s *next;
   /* The key to use (either the public key or the subkey).  */
   PKT_public_key *pk;
   kbnode_t keyblock;
 };
+typedef struct pubkey_s *pubkey_t;
 
 /* Free a single key.  This does not remove key from any list!  */
-void pubkey_free (struct pubkey *key);
+void pubkey_free (pubkey_t key);
 
 /* Free a list of public keys.  */
-void pubkeys_free (struct pubkey *keys);
+void pubkeys_free (pubkey_t keys);
 
 /* Returns all keys that match the search specfication SEARCH_TERMS.
    The returned keys should be freed using pubkeys_free.  */
@@ -506,7 +507,7 @@ gpg_error_t
 get_pubkeys (ctrl_t ctrl,
              char *search_terms, int use, int include_unusable, char *source,
              int warn_possibly_ambiguous,
-             struct pubkey **keys);
+             pubkey_t *r_keys);
 
 /* Find a public key identified by the name NAME.
 

commit 363ed2e892adc97fae97111bb56b64f9f809e8d5
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Dec 23 15:45:30 2015 +0100

    gpg: Simplify status message code from commit b30c15bf.
    
    * g10/keygen.c (card_write_key_to_backup_file): Simplify by using
    hexfingerprint.
    --
    
    Note that the extra blank added to FPRBUF in the old code was not
    needed because write_status_text_and_buffer already ensures that
    there will be a space.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/keygen.c b/g10/keygen.c
index 03fc53c..992e572 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -3861,28 +3861,13 @@ card_write_key_to_backup_file (PKT_public_key *sk, const char *backup_dir)
     }
   else
     {
-      unsigned char array[MAX_FINGERPRINT_LEN];
-      char *fprbuf, *p;
-      size_t n;
-      int i;
+      char *fprbuf;
 
       iobuf_close (fp);
       iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, (char*)fname);
       log_info (_("Note: backup of card key saved to '%s'\n"), fname);
 
-      fingerprint_from_pk (sk, array, &n);
-      p = fprbuf = xmalloc (MAX_FINGERPRINT_LEN*2 + 1 + 1);
-      if (!p)
-        {
-          err = gpg_error_from_syserror ();
-          goto leave;
-        }
-
-      for (i=0; i < n ; i++, p += 2)
-        sprintf (p, "%02X", array[i]);
-      *p++ = ' ';
-      *p = 0;
-
+      fprbuf = hexfingerprint (sk, NULL, 0);
       write_status_text_and_buffer (STATUS_BACKUP_KEY_CREATED, fprbuf,
                                     fname, strlen (fname), 0);
       xfree (fprbuf);

commit 04c9cddda95f2a8ca5c0cf10bb3dd6accf56cf45
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Dec 23 15:17:50 2015 +0100

    gpg: Add standard free() semantic to pubkey_free.
    
    * g10/getkey.c (pubkey_free): Check for NULL arg.
    --
    
    We don't like surprises ;-)
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/getkey.c b/g10/getkey.c
index a32e729..26b1932 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -369,9 +369,12 @@ getkey_disable_caches ()
 void
 pubkey_free (struct pubkey *key)
 {
-  xfree (key->pk);
-  release_kbnode (key->keyblock);
-  xfree (key);
+  if (key)
+    {
+      xfree (key->pk);
+      release_kbnode (key->keyblock);
+      xfree (key);
+    }
 }
 
 void

commit ef7b7e91600f35b4d682a6267001a8d30f0fa49f
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Dec 23 15:16:02 2015 +0100

    gpg: Fix use of assert from commit dc417bf0.
    
    * g10/keydb.c (keydb_update_keyblock): De-ref after the assert.  Use
    %zu for size_t.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/keydb.c b/g10/keydb.c
index fb4966c..2150a92 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -1386,12 +1386,13 @@ gpg_error_t
 keydb_update_keyblock (KEYDB_HANDLE hd, kbnode_t kb)
 {
   gpg_error_t err;
-  PKT_public_key *pk = kb->pkt->pkt.public_key;
+  PKT_public_key *pk;
   KEYDB_SEARCH_DESC desc;
   size_t len;
 
   assert (kb);
   assert (kb->pkt->pkttype == PKT_PUBLIC_KEY);
+  pk = kb->pkt->pkt.public_key;
 
   if (!hd)
     return gpg_error (GPG_ERR_INV_ARG);
@@ -1411,7 +1412,7 @@ keydb_update_keyblock (KEYDB_HANDLE hd, kbnode_t kb)
   if (len == 20)
     desc.mode = KEYDB_SEARCH_MODE_FPR20;
   else
-    log_bug ("%s: Unsupported key length: %zd\n", __func__, len);
+    log_bug ("%s: Unsupported key length: %zu\n", __func__, len);
 
   keydb_search_reset (hd);
   err = keydb_search (hd, &desc, 1, NULL);

commit b0c9867fb74d5a00335e6606d5bdcc5342ce26cd
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Dec 23 15:13:21 2015 +0100

    gpg: Do not translate debug output.
    
    * g10/getkey.c (parse_def_secret_key): Do not make strings passed to
    log_debug translatable.
    --
    
    Debug output is intended to be used along with the source or to be
    send to the developers.  Thus translations are at best not helpful.

diff --git a/g10/getkey.c b/g10/getkey.c
index 24c9636..a32e729 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -1501,21 +1501,21 @@ parse_def_secret_key (ctrl_t ctrl)
           if (pk->flags.revoked)
             {
               if (DBG_LOOKUP)
-                log_debug (_("not using %s as default key, %s"),
+                log_debug ("not using %s as default key, %s",
                            keystr_from_pk (pk), "revoked");
               continue;
             }
           if (pk->has_expired)
             {
               if (DBG_LOOKUP)
-                log_debug (_("not using %s as default key, %s"),
+                log_debug ("not using %s as default key, %s",
                            keystr_from_pk (pk), "expired");
               continue;
             }
           if (pk_is_disabled (pk))
             {
               if (DBG_LOOKUP)
-                log_debug (_("not using %s as default key, %s"),
+                log_debug ("not using %s as default key, %s",
                            keystr_from_pk (pk), "disabled");
               continue;
             }

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

Summary of changes:
 g10/getkey.c | 37 ++++++++++++++++++++-----------------
 g10/keydb.c  |  5 +++--
 g10/keydb.h  | 11 ++++++-----
 g10/keygen.c | 19 ++-----------------
 4 files changed, 31 insertions(+), 41 deletions(-)


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




More information about the Gnupg-commits mailing list