1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-16 00:29:50 +02:00

gpg: Improve verbose output during import.

* g10/import.c (chk_self_sigs): Print the subkeyid in addition to the
keyid.
(delete_inv_parts): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit 1bc6b51742)
This commit is contained in:
Werner Koch 2018-06-07 10:30:07 +02:00
parent c5c8fb1ec7
commit 36cc730fa5
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -2731,8 +2731,9 @@ import_revoke_cert (ctrl_t ctrl, kbnode_t node, struct import_stats_s *stats)
} }
/* Loop over the keyblock and check all self signatures. On return /* Loop over the KEYBLOCK and check all self signatures. KEYID is the
* the following bis in the node flags are set: * keyid of the primary key for reporting purposes. On return the
* following bits in the node flags are set:
* *
* - NODE_GOOD_SELFSIG :: User ID or subkey has a self-signature * - NODE_GOOD_SELFSIG :: User ID or subkey has a self-signature
* - NODE_BAD_SELFSIG :: Used ID or subkey has an invalid self-signature * - NODE_BAD_SELFSIG :: Used ID or subkey has an invalid self-signature
@ -2747,17 +2748,22 @@ import_revoke_cert (ctrl_t ctrl, kbnode_t node, struct import_stats_s *stats)
static int static int
chk_self_sigs (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid, int *non_self) chk_self_sigs (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid, int *non_self)
{ {
kbnode_t n, knode = NULL; kbnode_t knode = NULL; /* The node of the current subkey. */
PKT_public_key *subpk = NULL; /* and its packet. */
kbnode_t bsnode = NULL; /* Subkey binding signature node. */
u32 bsdate = 0; /* Timestamp of that node. */
kbnode_t rsnode = NULL; /* Subkey recocation signature node. */
u32 rsdate = 0; /* Timestamp of tha node. */
PKT_signature *sig; PKT_signature *sig;
int rc; int rc;
u32 bsdate=0, rsdate=0; kbnode_t n;
kbnode_t bsnode = NULL, rsnode = NULL;
for (n=keyblock; (n = find_next_kbnode (n, 0)); ) for (n=keyblock; (n = find_next_kbnode (n, 0)); )
{ {
if (n->pkt->pkttype == PKT_PUBLIC_SUBKEY) if (n->pkt->pkttype == PKT_PUBLIC_SUBKEY)
{ {
knode = n; knode = n;
subpk = knode->pkt->pkt.public_key;
bsdate = 0; bsdate = 0;
rsdate = 0; rsdate = 0;
bsnode = NULL; bsnode = NULL;
@ -2846,11 +2852,14 @@ chk_self_sigs (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid, int *non_self)
if ( rc ) if ( rc )
{ {
if (opt.verbose) if (opt.verbose)
log_info (gpg_err_code (rc) == GPG_ERR_PUBKEY_ALGO ? {
_("key %s: unsupported public key" keyid_from_pk (subpk, NULL);
" algorithm\n"): log_info (gpg_err_code (rc) == GPG_ERR_PUBKEY_ALGO ?
_("key %s: invalid subkey binding\n"), _("key %s: unsupported public key"
keystr (keyid)); " algorithm\n"):
_("key %s: invalid subkey binding\n"),
keystr_with_sub (keyid, subpk->keyid));
}
n->flag |= NODE_DELETION_MARK; n->flag |= NODE_DELETION_MARK;
} }
else else
@ -2865,8 +2874,12 @@ chk_self_sigs (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid, int *non_self)
one is newer */ one is newer */
bsnode->flag |= NODE_DELETION_MARK; bsnode->flag |= NODE_DELETION_MARK;
if (opt.verbose) if (opt.verbose)
log_info (_("key %s: removed multiple subkey" {
" binding\n"),keystr(keyid)); keyid_from_pk (subpk, NULL);
log_info (_("key %s: removed multiple subkey"
" binding\n"),
keystr_with_sub (keyid, subpk->keyid));
}
} }
bsnode = n; bsnode = n;
@ -2945,6 +2958,7 @@ delete_inv_parts (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid,
{ {
kbnode_t node; kbnode_t node;
int nvalid=0, uid_seen=0, subkey_seen=0; int nvalid=0, uid_seen=0, subkey_seen=0;
PKT_public_key *pk;
for (node=keyblock->next; node; node = node->next ) for (node=keyblock->next; node; node = node->next )
{ {
@ -2982,7 +2996,12 @@ delete_inv_parts (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid,
|| !(node->flag & NODE_GOOD_SELFSIG)) || !(node->flag & NODE_GOOD_SELFSIG))
{ {
if (opt.verbose ) if (opt.verbose )
log_info( _("key %s: skipped subkey\n"),keystr(keyid)); {
pk = node->pkt->pkt.public_key;
keyid_from_pk (pk, NULL);
log_info (_("key %s: skipped subkey\n"),
keystr_with_sub (keyid, pk->keyid));
}
delete_kbnode( node ); /* the subkey */ delete_kbnode( node ); /* the subkey */
/* and all following signature packets */ /* and all following signature packets */