[git] GnuPG - branch, master, updated. gnupg-2.1.20-112-g2273943

by Justus Winter cvs at cvs.gnupg.org
Mon May 8 14:36:34 CEST 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 GNU Privacy Guard".

The branch, master has been updated
       via  22739433e98be80e46fe7d01d52a9627c1aebaae (commit)
       via  692208fd6c1547cc7dd2062a1d1c9499bc0a8be4 (commit)
       via  38b48eb11b77b45c9d0292270f83e26e308f68e4 (commit)
       via  6fdeef5b61c814ba0e475bfc36655e4fe69d7c41 (commit)
      from  d6b46462f8c5c705ffb7cf8af03465a926aa11d3 (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 22739433e98be80e46fe7d01d52a9627c1aebaae
Author: Justus Winter <justus at g10code.com>
Date:   Mon May 8 14:24:00 2017 +0200

    gpg: Properly account for ring trust packets.
    
    * g10/keyring.c (keyring_get_keyblock): Use the parser's packet count
    instead of counting ourself.
    * g10/packet.h (struct parse_packet_ctx_s): New field
    'n_parsed_packets'.
    (init_parse_packet): Initialize new field.
    * g10/parse-packet.c (parse): Count packets.
    --
    
    The 'keyring' keystore depends on the number of packets for delete and
    update operations.  With the rework of the ring trust packets, the
    trust packets were no longer properly accounted for leading to keyring
    corruptions.
    
    The 'keybox' store was not affected.
    
    GnuPG-bug-id: 3123
    GnuPG-bug-id: 3135
    GnuPG-bug-id: 3144
    Fixes-commit: a8895c99a7d0750132477d80cd66caaf3a709113
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/g10/keyring.c b/g10/keyring.c
index e223f0f..50f1b82 100644
--- a/g10/keyring.c
+++ b/g10/keyring.c
@@ -409,11 +409,11 @@ keyring_get_keyblock (KEYRING_HANDLE hd, KBNODE *ret_kb)
     pkt = xmalloc (sizeof *pkt);
     init_packet (pkt);
     init_parse_packet (&parsectx, a);
-    hd->found.n_packets = 0;;
+    hd->found.n_packets = 0;
     lastnode = NULL;
     save_mode = set_packet_list_mode(0);
     while ((rc=parse_packet (&parsectx, pkt)) != -1) {
-        hd->found.n_packets++;
+        hd->found.n_packets = parsectx.n_parsed_packets;
         if (gpg_err_code (rc) == GPG_ERR_UNKNOWN_PACKET) {
 	    free_packet (pkt, &parsectx);
 	    init_packet (pkt);
diff --git a/g10/packet.h b/g10/packet.h
index d42510d..cf2121c 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -624,6 +624,7 @@ struct parse_packet_ctx_s
   struct packet_struct last_pkt; /* The last parsed packet.  */
   int free_last_pkt; /* Indicates that LAST_PKT must be freed.  */
   int skip_meta;     /* Skip ring trust packets.  */
+  unsigned int n_parsed_packets;	/* Number of parsed packets.  */
 };
 typedef struct parse_packet_ctx_s *parse_packet_ctx_t;
 
@@ -633,6 +634,7 @@ typedef struct parse_packet_ctx_s *parse_packet_ctx_t;
     (a)->last_pkt.pkt.generic= NULL;\
     (a)->free_last_pkt = 0;         \
     (a)->skip_meta = 0;             \
+    (a)->n_parsed_packets = 0;      \
   } while (0)
 
 #define deinit_parse_packet(a) do { \
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index fa44f83..dbb7af8 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -764,6 +764,9 @@ parse (parse_packet_ctx_t ctx, PACKET *pkt, int onlykeypkts, off_t * retpos,
                 partial? (new_ctb ? " partial" : " indeterminate") :"",
                 new_ctb? " new-ctb":"");
 
+  /* Count it.  */
+  ctx->n_parsed_packets++;
+
   pkt->pkttype = pkttype;
   rc = GPG_ERR_UNKNOWN_PACKET;	/* default error */
   switch (pkttype)

commit 692208fd6c1547cc7dd2062a1d1c9499bc0a8be4
Author: Justus Winter <justus at g10code.com>
Date:   Mon May 8 13:52:39 2017 +0200

    gpg: Fix typo.
    
    --
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/g10/packet.h b/g10/packet.h
index a10495c..d42510d 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -623,7 +623,7 @@ struct parse_packet_ctx_s
   iobuf_t inp;       /* The input stream with the packets.  */
   struct packet_struct last_pkt; /* The last parsed packet.  */
   int free_last_pkt; /* Indicates that LAST_PKT must be freed.  */
-  int skip_meta;     /* Skip right trust packets.  */
+  int skip_meta;     /* Skip ring trust packets.  */
 };
 typedef struct parse_packet_ctx_s *parse_packet_ctx_t;
 

commit 38b48eb11b77b45c9d0292270f83e26e308f68e4
Author: Justus Winter <justus at g10code.com>
Date:   Mon May 8 12:37:20 2017 +0200

    tests: Clarify comments.
    
    --
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/openpgp/delete-keys.scm b/tests/openpgp/delete-keys.scm
index 76cd424..16bde5f 100755
--- a/tests/openpgp/delete-keys.scm
+++ b/tests/openpgp/delete-keys.scm
@@ -58,13 +58,16 @@
   (call-check `(, at gpg --delete-secret-keys ,subkey::fpr))
   (assert (have-public-key? key))
   (assert (have-public-key? subkey))
-  ;; JW: Deleting the secret subkey also deletes the secret key.
+  ;; JW: Deleting the secret subkey also deletes the secret key.  This
+  ;; is a deliberate design choice, and currently there is no way to
+  ;; delete the subkey without using --edit-key.
   ;; XXX (assert (have-secret-key? key))
   ;; XXX (assert (have-secret-key-file? key))
   (assert (not (have-secret-key? subkey)))
   (assert (not (have-secret-key-file? subkey)))
 
   ;; Then, delete the secret key.
+  ;; JW: We already deleted the key.  See above.
   ;; XXX (call-check `(, at gpg --delete-secret-keys ,key::fpr))
   (assert (have-public-key? key))
   (assert (have-public-key? subkey))
@@ -75,11 +78,14 @@
 
   ;; Now, delete the public subkey.
   (call-check `(, at gpg --delete-keys ,subkey::fpr))
-  ;; JW: Deleting the subkey also deletes the key.
+  ;; JW: Deleting the subkey also deletes the key.  This
+  ;; is a deliberate design choice, and currently there is no way to
+  ;; delete the subkey without using --edit-key.
   ;; XXX (assert (have-public-key? key))
   (assert (not (have-public-key? subkey)))
 
   ;; Now, delete the public key.
+  ;; JW: We already deleted the key.  See above.
   ;; XXX (call-check `(, at gpg --delete-keys ,key::fpr))
   (assert (not (have-public-key? key)))
   (assert (not (have-public-key? subkey))))

commit 6fdeef5b61c814ba0e475bfc36655e4fe69d7c41
Author: Justus Winter <justus at g10code.com>
Date:   Mon May 8 12:18:19 2017 +0200

    doc: Fix documentation.
    
    --
    Fixes-commit: da4db172f6f8fb254b770e59770c531a488e2400
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/doc/gpg.texi b/doc/gpg.texi
index aa55cb8..1a0ea55 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -393,7 +393,7 @@ functionality is also available as the subcommand "passwd" with the
 @option{--edit-card} command.
 
 @item --delete-keys @code{name}
- at itemx --delete-keys @code{name}
+ at opindex delete-keys
 Remove key from the public keyring. In batch mode either @option{--yes} is
 required or the key must be specified by fingerprint. This is a
 safeguard against accidental deletion of multiple keys.

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

Summary of changes:
 doc/gpg.texi                  |  2 +-
 g10/keyring.c                 |  4 ++--
 g10/packet.h                  |  4 +++-
 g10/parse-packet.c            |  3 +++
 tests/openpgp/delete-keys.scm | 10 ++++++++--
 5 files changed, 17 insertions(+), 6 deletions(-)


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




More information about the Gnupg-commits mailing list