From 7d6ad2866722aaa27b33338d0fbb33c7b6b94808 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 17 Apr 2024 12:16:20 +0200 Subject: gpg: Mark disabled keys and add show-ownertrust list option. * g10/options.h (LIST_SHOW_OWNERTRUST): New. * g10/keylist.c (print_key_line): Show wonertrust and always show whether a key is disabled. * g10/gpg.c (parse_list_options): Add "show-ownertrust". * g10/gpgv.c (get_ownertrust_string): Add stub. * g10/test-stubs.c (get_ownertrust_string): Add stub. -- Note that in a --with-colons listing the ownertrust has always been emitted and the disabled state is marked in that listing with a special 'D' usage. --- g10/keylist.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'g10/keylist.c') diff --git a/g10/keylist.c b/g10/keylist.c index 7fb5eff72..7717ca563 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -2600,6 +2600,11 @@ print_key_line (ctrl_t ctrl, estream_t fp, PKT_public_key *pk, int secret) tty_fprintf (fp, " [%s]", usagestr_from_pk (pk, 0)); } + if (pk->flags.primary && (opt.list_options & LIST_SHOW_OWNERTRUST)) + { + tty_fprintf (fp, " [%s]", get_ownertrust_string (ctrl, pk, 0)); + } + if (pk->flags.revoked) { tty_fprintf (fp, " ["); @@ -2619,21 +2624,14 @@ print_key_line (ctrl_t ctrl, estream_t fp, PKT_public_key *pk, int secret) tty_fprintf (fp, "]"); } -#if 0 - /* I need to think about this some more. It's easy enough to - include, but it looks sort of confusing in the listing... */ - if (opt.list_options & LIST_SHOW_VALIDITY) - { - int validity = get_validity (ctrl, pk, NULL, NULL, 0); - tty_fprintf (fp, " [%s]", trust_value_to_string (validity)); - } -#endif - if (pk->pubkey_algo >= 100) tty_fprintf (fp, " [experimental algorithm %d]", pk->pubkey_algo); tty_fprintf (fp, "\n"); + if (pk->flags.primary && pk_is_disabled (pk)) + es_fprintf (es_stdout, " *** %s\n", _("This key has been disabled")); + /* if the user hasn't explicitly asked for human-readable fingerprints, show compact fpr of primary key: */ if (pk->flags.primary && -- cgit v1.2.3