mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-23 15:07:03 +01:00
gpg: Make sure that keygrips are printed for each subkey.
* g10/keylist.c (list_keyblock_colon): Print an emprty grip in case of an error. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
54a1ed20e2
commit
c8cc804f56
@ -1186,7 +1186,8 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock,
|
|||||||
int ulti_hack = 0;
|
int ulti_hack = 0;
|
||||||
int i;
|
int i;
|
||||||
char *p;
|
char *p;
|
||||||
char *hexgrip = NULL;
|
char *hexgrip_buffer = NULL;
|
||||||
|
const char *hexgrip = NULL;
|
||||||
char *serialno = NULL;
|
char *serialno = NULL;
|
||||||
int stubkey;
|
int stubkey;
|
||||||
|
|
||||||
@ -1202,9 +1203,13 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock,
|
|||||||
pk = node->pkt->pkt.public_key;
|
pk = node->pkt->pkt.public_key;
|
||||||
if (secret || has_secret || opt.with_keygrip || opt.with_key_data)
|
if (secret || has_secret || opt.with_keygrip || opt.with_key_data)
|
||||||
{
|
{
|
||||||
rc = hexkeygrip_from_pk (pk, &hexgrip);
|
rc = hexkeygrip_from_pk (pk, &hexgrip_buffer);
|
||||||
if (rc)
|
if (rc)
|
||||||
log_error ("error computing a keygrip: %s\n", gpg_strerror (rc));
|
log_error ("error computing a keygrip: %s\n", gpg_strerror (rc));
|
||||||
|
/* In the error case we print an empty string so that we have a
|
||||||
|
* "grp" record for each and subkey - even if it is empty. This
|
||||||
|
* may help to prevent sync problems. */
|
||||||
|
hexgrip = hexgrip_buffer? hexgrip_buffer : "";
|
||||||
}
|
}
|
||||||
stubkey = 0;
|
stubkey = 0;
|
||||||
if ((secret || has_secret)
|
if ((secret || has_secret)
|
||||||
@ -1338,16 +1343,19 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock,
|
|||||||
{
|
{
|
||||||
u32 keyid2[2];
|
u32 keyid2[2];
|
||||||
PKT_public_key *pk2;
|
PKT_public_key *pk2;
|
||||||
|
int need_hexgrip = !!hexgrip;
|
||||||
|
|
||||||
pk2 = node->pkt->pkt.public_key;
|
pk2 = node->pkt->pkt.public_key;
|
||||||
xfree (hexgrip); hexgrip = NULL;
|
xfree (hexgrip_buffer); hexgrip_buffer = NULL; hexgrip = NULL;
|
||||||
xfree (serialno); serialno = NULL;
|
xfree (serialno); serialno = NULL;
|
||||||
if (secret || has_secret || opt.with_keygrip || opt.with_key_data)
|
if (need_hexgrip
|
||||||
|
|| secret || has_secret || opt.with_keygrip || opt.with_key_data)
|
||||||
{
|
{
|
||||||
rc = hexkeygrip_from_pk (pk2, &hexgrip);
|
rc = hexkeygrip_from_pk (pk2, &hexgrip_buffer);
|
||||||
if (rc)
|
if (rc)
|
||||||
log_error ("error computing a keygrip: %s\n",
|
log_error ("error computing a keygrip: %s\n",
|
||||||
gpg_strerror (rc));
|
gpg_strerror (rc));
|
||||||
|
hexgrip = hexgrip_buffer? hexgrip_buffer : "";
|
||||||
}
|
}
|
||||||
stubkey = 0;
|
stubkey = 0;
|
||||||
if ((secret||has_secret)
|
if ((secret||has_secret)
|
||||||
@ -1523,7 +1531,7 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree (hexgrip);
|
xfree (hexgrip_buffer);
|
||||||
xfree (serialno);
|
xfree (serialno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user