diff options
author | Justus Winter <[email protected]> | 2017-05-08 12:24:00 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-05-08 12:33:11 +0000 |
commit | 22739433e98be80e46fe7d01d52a9627c1aebaae (patch) | |
tree | 494ef5b580e88abf4242bca88a2689fc1cb4601e /g10/parse-packet.c | |
parent | gpg: Fix typo. (diff) | |
download | gnupg-22739433e98be80e46fe7d01d52a9627c1aebaae.tar.gz gnupg-22739433e98be80e46fe7d01d52a9627c1aebaae.zip |
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 <[email protected]>
Diffstat (limited to 'g10/parse-packet.c')
-rw-r--r-- | g10/parse-packet.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/g10/parse-packet.c b/g10/parse-packet.c index fa44f8389..dbb7af84d 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) |