1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

agent: Add option --status to the LISTRUSTED command.

* agent/trustlist.c (istrusted_internal): Add arg listmode and print
new status line in this mode.  Adjust callers.
(agent_listtrusted): Add new args ctrl and status_mode.  Get all
trusted keys and then call is_trusted_internal for all of them.

* agent/command.c (cmd_listtrusted): Add new option --status.
--

This allows in a non-restricted connection to list all trusted keys in
one go.
This commit is contained in:
Werner Koch 2024-10-01 18:07:32 +02:00
parent f50dde6269
commit 4275d5fa7a
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 60 additions and 16 deletions

View file

@ -569,22 +569,24 @@ cmd_istrusted (assuan_context_t ctx, char *line)
static const char hlp_listtrusted[] =
"LISTTRUSTED\n"
"LISTTRUSTED [--status]\n"
"\n"
"List all entries from the trustlist.";
"List all entries from the trustlist. With --status the\n"
"keys are listed using status line similar to ISTRUSTED";
static gpg_error_t
cmd_listtrusted (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
int rc;
gpg_error_t err;
int opt_status;
(void)line;
opt_status = has_option (line, "--status");
if (ctrl->restricted)
return leave_cmd (ctx, gpg_error (GPG_ERR_FORBIDDEN));
rc = agent_listtrusted (ctx);
return leave_cmd (ctx, rc);
err = agent_listtrusted (ctrl, ctx, opt_status);
return leave_cmd (ctx, err);
}