From 21c0ea6bafafbcc4a2e07f0ac76275cc0229e9a0 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 13 Oct 2014 14:54:26 +0200 Subject: gpg: Fix informative printing of user ids. * g10/getkey.c (keyid_list): Add field "fpr". (cache_user_id): Store fpr and check for dups only by fpr. (get_pubkey_byfpr): New. (get_user_id_string): Make static and use xasprintf. (get_long_user_id_string): Use xasprintf. (get_user_id_byfpr): New. (get_user_id_byfpr_native): New. * g10/keyid.c (fingerprint_from_pk): Make arg RET_LEN optional. * g10/import.c (import_one): Use get_user_id_byfpr_native. -- We now cache the userids using the fingerprint. This allows to print the correct user id for keys with a duplicated key id. We should eventually start to retire the use of all the old keyid based functions. However, at some places we only have the keyid and thus some of them will need to be kept (maybe changed with an indication to show that more than several user ids are matching). Signed-off-by: Werner Koch --- g10/keyid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'g10/keyid.c') diff --git a/g10/keyid.c b/g10/keyid.c index 3b4c10c65..8b4eeb1f2 100644 --- a/g10/keyid.c +++ b/g10/keyid.c @@ -767,7 +767,8 @@ fingerprint_from_pk (PKT_public_key *pk, byte *array, size_t *ret_len) gcry_md_close( md); } - *ret_len = len; + if (ret_len) + *ret_len = len; return array; } -- cgit v1.2.3