1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

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.
This commit is contained in:
Werner Koch 2024-04-17 12:16:20 +02:00
parent 21f7ad563d
commit 7d6ad28667
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
6 changed files with 33 additions and 10 deletions

View File

@ -1403,6 +1403,11 @@ give the opposite meaning. The options are:
key (@code{E}=encryption, @code{S}=signing, @code{C}=certification, key (@code{E}=encryption, @code{S}=signing, @code{C}=certification,
@code{A}=authentication). Defaults to yes. @code{A}=authentication). Defaults to yes.
@item show-ownertrust
@opindex list-options:show-ownertrust
Show the ownertrust value for keys also in the standard key
listing. Defaults to no.
@item show-policy-urls @item show-policy-urls
@opindex list-options:show-policy-urls @opindex list-options:show-policy-urls
Show policy URLs in the @option{--check-signatures} Show policy URLs in the @option{--check-signatures}

View File

@ -2113,6 +2113,8 @@ parse_list_options(char *str)
N_("show preferences")}, N_("show preferences")},
{"show-pref-verbose", LIST_SHOW_PREF_VERBOSE, NULL, {"show-pref-verbose", LIST_SHOW_PREF_VERBOSE, NULL,
N_("show preferences")}, N_("show preferences")},
{"show-ownertrust", LIST_SHOW_OWNERTRUST, NULL,
N_("show ownertrust")},
{"show-only-fpr-mbox",LIST_SHOW_ONLY_FPR_MBOX, NULL, {"show-only-fpr-mbox",LIST_SHOW_ONLY_FPR_MBOX, NULL,
NULL}, NULL},
{"sort-sigs", LIST_SORT_SIGS, NULL, {"sort-sigs", LIST_SORT_SIGS, NULL,

View File

@ -426,6 +426,14 @@ get_ownertrust (ctrl_t ctrl, PKT_public_key *pk)
return TRUST_UNKNOWN; return TRUST_UNKNOWN;
} }
const char *
get_ownertrust_string (ctrl_t ctrl, PKT_public_key *pk, int no_create)
{
(void)ctrl;
(void)pk;
(void)no_create;
return "";
}
/* Stubs: /* Stubs:
* Because we only work with trusted keys, it does not make sense to * Because we only work with trusted keys, it does not make sense to

View File

@ -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)); 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) if (pk->flags.revoked)
{ {
tty_fprintf (fp, " ["); 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, "]"); 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) if (pk->pubkey_algo >= 100)
tty_fprintf (fp, " [experimental algorithm %d]", pk->pubkey_algo); tty_fprintf (fp, " [experimental algorithm %d]", pk->pubkey_algo);
tty_fprintf (fp, "\n"); 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 /* if the user hasn't explicitly asked for human-readable
fingerprints, show compact fpr of primary key: */ fingerprints, show compact fpr of primary key: */
if (pk->flags.primary && if (pk->flags.primary &&

View File

@ -445,6 +445,7 @@ EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
#define LIST_SHOW_UNUSABLE_SIGS (1<<16) #define LIST_SHOW_UNUSABLE_SIGS (1<<16)
#define LIST_SHOW_X509_NOTATIONS (1<<17) #define LIST_SHOW_X509_NOTATIONS (1<<17)
#define LIST_STORE_X509_NOTATIONS (1<<18) #define LIST_STORE_X509_NOTATIONS (1<<18)
#define LIST_SHOW_OWNERTRUST (1<<19)
#define VERIFY_SHOW_PHOTOS (1<<0) #define VERIFY_SHOW_PHOTOS (1<<0)
#define VERIFY_SHOW_POLICY_URLS (1<<1) #define VERIFY_SHOW_POLICY_URLS (1<<1)

View File

@ -155,6 +155,15 @@ get_ownertrust_info (ctrl_t ctrl, PKT_public_key *pk, int no_create)
return '?'; return '?';
} }
const char *
get_ownertrust_string (ctrl_t ctrl, PKT_public_key *pk, int no_create)
{
(void)ctrl;
(void)pk;
(void)no_create;
return "";
}
unsigned int unsigned int
get_ownertrust (ctrl_t ctrl, PKT_public_key *pk) get_ownertrust (ctrl_t ctrl, PKT_public_key *pk)
{ {