g10: Fix key import statistics.
authorJustus Winter <justus@g10code.com>
Mon, 25 Jul 2016 10:41:28 +0000 (12:41 +0200)
committerJustus Winter <justus@g10code.com>
Mon, 25 Jul 2016 10:50:35 +0000 (12:50 +0200)
commit4ba11251aff578394000bf480f47160f0879c763
tree5e5b60e8614f61b88514d4682c37c461d23fa019
parent9ee23a715d5dad6bf568a2deb1c55bf15601cf51
g10: Fix key import statistics.

'transfer_secret_keys' collects statistics on a subkey-basis, while
the other code does not.  This leads to inflated numbers when
importing secret keys.  E.g. 'count' is incremented by the main
parsing loop in 'import', and again in 'transfer_secret_keys', leading
to a total of 3 if one key with two secret subkeys is imported.

* g10/import.c (import_secret_one): Adjust to the fact that
'transfer_secret_keys' collects subkey statistics.
* tests/openpgp/Makefile.am (TESTS): Add new test.
* tests/openpgp/issue2346.scm: New file.
* tests/openpgp/samplekeys/issue2346.gpg: Likewise.

GnuPG-bug-id: 2346
Signed-off-by: Justus Winter <justus@g10code.com>
g10/import.c
tests/openpgp/Makefile.am
tests/openpgp/issue2346.scm [new file with mode: 0755]
tests/openpgp/samplekeys/issue2346.gpg [new file with mode: 0644]