[git] GnuPG - branch, master, updated. gnupg-2.1.13-50-g1e5959e

by Werner Koch cvs at cvs.gnupg.org
Thu Jun 23 20:06:34 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  1e5959ec059ba41f4de1e2f953300bc040efc16f (commit)
       via  09c6f7135150efbbeb459d4ae0189a81e9d180f8 (commit)
       via  c229ba4d8b9b16052ee0b9573bed7905be602cdf (commit)
      from  e584d6468a2e72cd01e55f46104f9f96b56c0b66 (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 1e5959ec059ba41f4de1e2f953300bc040efc16f
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Jun 23 19:25:53 2016 +0200

    gpg: New import option "import-show".
    
    * g10/options.h (IMPORT_SHOW): New.
    * g10/import.c (parse_import_options): Add "import-show".
    (import_one): Implement that.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/doc/gpg.texi b/doc/gpg.texi
index 3ea298e..15f58f4 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -233,7 +233,7 @@ read from STDIN.  If only a one argument is given, it is expected to
 be a complete signature.
 
 With more than 1 argument, the first should be a detached signature
-and the remaining files ake up the the signed data. To read the signed
+and the remaining files make up the the signed data. To read the signed
 data from STDIN, use @samp{-} as the second filename.  For security
 reasons a detached signature cannot read the signed material from
 STDIN without denoting it in the above way.
@@ -2180,6 +2180,11 @@ opposite meaning. The options are:
   subkey. Defaults to no for regular @option{--import} and to yes for
   keyserver @option{--recv-keys}.
 
+  @item import-show
+  Show a listing of the key as imported right before it is stored.
+  This can be combined with the option @option{--dry-run} to only look
+  at keys.
+
   @item merge-only
   During import, allow key updates to existing keys, but do not allow
   any new keys to be imported. Defaults to no.
diff --git a/g10/import.c b/g10/import.c
index 7c0d1e2..c4992be 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -112,6 +112,9 @@ parse_import_options(char *str,unsigned int *options,int noisy)
       {"fast-import",IMPORT_FAST,NULL,
        N_("do not update the trustdb after import")},
 
+      {"import-show",IMPORT_SHOW,NULL,
+       N_("show key during import")},
+
       {"merge-only",IMPORT_MERGE_ONLY,NULL,
        N_("only accept updates to existing keys")},
 
@@ -936,7 +939,7 @@ import_one (ctrl_t ctrl,
             import_screener_t screener, void *screener_arg)
 {
   PKT_public_key *pk;
-  PKT_public_key *pk_orig;
+  PKT_public_key *pk_orig = NULL;
   kbnode_t node, uidnode;
   kbnode_t keyblock_orig = NULL;
   byte fpr2[MAX_FINGERPRINT_LEN];
@@ -1050,6 +1053,22 @@ import_one (ctrl_t ctrl,
       return 0;
     }
 
+  /* Get rid of deleted nodes.  */
+  commit_kbnode (&keyblock);
+
+  /* Show the key in the form it is merged or inserted. */
+  if ((options & IMPORT_SHOW))
+    {
+      merge_keys_and_selfsig (keyblock);
+      /* Note that we do not want to show the validity because the key
+       * has not yet imported.  */
+      list_keyblock_direct (ctrl, keyblock, 0, 0, 1, 1);
+      es_fflush (es_stdout);
+    }
+
+  if (opt.dry_run)
+    goto leave;
+
   /* Do we have this key already in one of our pubrings ? */
   pk_orig = xmalloc_clear( sizeof *pk_orig );
   rc = get_pubkey_byfprint_fast (pk_orig, fpr2, fpr2len);
@@ -1258,7 +1277,7 @@ import_one (ctrl_t ctrl,
       keydb_release (hd); hd = NULL;
     }
 
-  leave:
+ leave:
   if (mod_key || new_key || same_key)
     {
       /* A little explanation for this: we fill in the fingerprint
diff --git a/g10/options.h b/g10/options.h
index e14bc07..58cf1f9 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -334,6 +334,7 @@ EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
 #define IMPORT_LOCAL_SIGS                (1<<0)
 #define IMPORT_REPAIR_PKS_SUBKEY_BUG     (1<<1)
 #define IMPORT_FAST                      (1<<2)
+#define IMPORT_SHOW                      (1<<3)
 #define IMPORT_MERGE_ONLY                (1<<4)
 #define IMPORT_MINIMAL                   (1<<5)
 #define IMPORT_CLEAN                     (1<<6)

commit 09c6f7135150efbbeb459d4ae0189a81e9d180f8
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Jun 23 19:22:13 2016 +0200

    gpg: Do not print the validity after key generation.
    
    * g10/keylist.c (struct keylist_context): Add field NO_VALIDITY.
    (list_keyblock_print): Take care of it.
    (list_keyblock_direct): Add arg NO_VALIDITY.
    * g10/keygen.c (do_generate_keypair): Merge keyblock and print w/o
    validity.
    --
    
    It will always be ultimate and by not printing it we avoid a lot of
    garbage output due to the trustdb re-calculation.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/g10/keygen.c b/g10/keygen.c
index 74fd370..b7c8e83 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -4340,11 +4340,15 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
 
           gen_standard_revoke (pk, cache_nonce);
 
+          /* Get rid of the first empty packet.  */
+          commit_kbnode (&pub_root);
+
           if (!opt.batch)
             {
               tty_printf (_("public and secret key created and signed.\n") );
               tty_printf ("\n");
-              list_keyblock_direct (ctrl, pub_root, 0, 1, 1);
+              merge_keys_and_selfsig (pub_root);
+              list_keyblock_direct (ctrl, pub_root, 0, 1, 1, 1);
             }
 
 
diff --git a/g10/keylist.c b/g10/keylist.c
index 0ac763d..e595fe3 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -59,6 +59,7 @@ struct keylist_context
   int inv_sigs;    /* Counter used if CHECK_SIGS is set.  */
   int no_key;      /* Counter used if CHECK_SIGS is set.  */
   int oth_err;     /* Counter used if CHECK_SIGS is set.  */
+  int no_validity; /* Do not show validity.  */
 };
 
 
@@ -1052,7 +1053,8 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr,
         secret = 2;  /* Key not found.  */
     }
 
-  check_trustdb_stale (ctrl);
+  if (!listctx->no_validity)
+    check_trustdb_stale (ctrl);
 
   /* Print the "pub" line and in KF_NONE mode the fingerprint.  */
   print_key_line (es_stdout, pk, secret);
@@ -1090,7 +1092,8 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr,
 	    dump_attribs (uid, pk);
 
 	  if ((uid->is_revoked || uid->is_expired)
-	      || (opt.list_options & LIST_SHOW_UID_VALIDITY))
+	      || ((opt.list_options & LIST_SHOW_UID_VALIDITY)
+                  && !listctx->no_validity))
 	    {
 	      const char *validity;
 
@@ -1755,14 +1758,17 @@ list_keyblock (ctrl_t ctrl,
 }
 
 
-/* Public function used by keygen to list a keyblock.  */
+/* Public function used by keygen to list a keyblock.  If NO_VALIDITY
+ * is set the validity of a key is never shown.  */
 void
 list_keyblock_direct (ctrl_t ctrl,
-                      kbnode_t keyblock, int secret, int has_secret, int fpr)
+                      kbnode_t keyblock, int secret, int has_secret, int fpr,
+                      int no_validity)
 {
   struct keylist_context listctx;
 
   memset (&listctx, 0, sizeof (listctx));
+  listctx.no_validity = !!no_validity;
   list_keyblock (ctrl, keyblock, secret, has_secret, fpr, &listctx);
   keylist_context_release (&listctx);
 }
diff --git a/g10/main.h b/g10/main.h
index 7b716ff..e6f2070 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -415,7 +415,7 @@ void secret_key_list (ctrl_t ctrl, strlist_t list );
 void print_subpackets_colon(PKT_signature *sig);
 void reorder_keyblock (KBNODE keyblock);
 void list_keyblock_direct (ctrl_t ctrl, kbnode_t keyblock, int secret,
-                           int has_secret, int fpr);
+                           int has_secret, int fpr, int no_validity);
 void print_fingerprint (estream_t fp, PKT_public_key *pk, int mode);
 void print_revokers (estream_t fp, PKT_public_key *pk);
 void show_policy_url(PKT_signature *sig,int indent,int mode);

commit c229ba4d8b9b16052ee0b9573bed7905be602cdf
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Jun 23 17:44:55 2016 +0200

    common: Fix possible small memory leak in b64dec.c.
    
    * common/b64dec.c (b64dec_finish): Always release TITLE.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/common/b64dec.c b/common/b64dec.c
index 9e8fb78..c84c35a 100644
--- a/common/b64dec.c
+++ b/common/b64dec.c
@@ -243,10 +243,11 @@ b64dec_proc (struct b64state *state, void *buffer, size_t length,
 gpg_error_t
 b64dec_finish (struct b64state *state)
 {
+  xfree (state->title);
+  state->title = NULL;
+
   if (state->lasterr)
     return state->lasterr;
 
-  xfree (state->title);
-  state->title = NULL;
   return state->invalid_encoding? gpg_error(GPG_ERR_BAD_DATA): 0;
 }

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

Summary of changes:
 common/b64dec.c |  5 +++--
 doc/gpg.texi    |  7 ++++++-
 g10/import.c    | 23 +++++++++++++++++++++--
 g10/keygen.c    |  6 +++++-
 g10/keylist.c   | 14 ++++++++++----
 g10/main.h      |  2 +-
 g10/options.h   |  1 +
 7 files changed, 47 insertions(+), 11 deletions(-)


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




More information about the Gnupg-commits mailing list