diff options
author | Werner Koch <wk@gnupg.org> | 2015-11-12 17:02:18 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2015-11-12 17:02:18 +0100 |
commit | 2038adf16d0e7eeb614043aae17b16a867de6b70 (patch) | |
tree | f48e363626f96330f865a340a16d28bc64f135d6 /g10 | |
parent | gpg: Print export statistics to the status-fd. (diff) | |
download | gnupg2-2038adf16d0e7eeb614043aae17b16a867de6b70.tar.xz gnupg2-2038adf16d0e7eeb614043aae17b16a867de6b70.zip |
gpg: Print a new EXPORTED status line.
* common/status.h (STATUS_EXPORTED): New.
* g10/export.c (print_status_exported): New.
(do_export_stream): Call that function.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10')
-rw-r--r-- | g10/export.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/g10/export.c b/g10/export.c index d84ff7459..b9272515f 100644 --- a/g10/export.c +++ b/g10/export.c @@ -809,6 +809,22 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk) goto leave; } + +/* Print an "EXPORTED" status line. PK is the primary public key. */ +static void +print_status_exported (PKT_public_key *pk) +{ + char *hexfpr; + + if (!is_status_enabled ()) + return; + + hexfpr = hexfingerprint (pk); + write_status_text (STATUS_EXPORTED, hexfpr? hexfpr : "[?]"); + xfree (hexfpr); +} + + /* Export the keys identified by the list of strings in USERS to the stream OUT. If Secret is false public keys will be exported. With secret true secret keys will be exported; in this case 1 means the @@ -1182,7 +1198,10 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret, err = build_packet (out, node->pkt); if (!err && node->pkt->pkttype == PKT_PUBLIC_KEY) - stats->exported++; + { + stats->exported++; + print_status_exported (node->pkt->pkt.public_key); + } } else if (!err) { @@ -1239,7 +1258,10 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret, err = build_packet (out, node->pkt); if (!err && node->pkt->pkttype == PKT_PUBLIC_KEY) - stats->exported++; + { + stats->exported++; + print_status_exported (node->pkt->pkt.public_key); + } goto unwraperror_leave; unwraperror: @@ -1278,7 +1300,10 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret, { err = build_packet (out, node->pkt); if (!err && node->pkt->pkttype == PKT_PUBLIC_KEY) - stats->exported++; + { + stats->exported++; + print_status_exported (node->pkt->pkt.public_key); + } } |