1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-06 23:17:47 +02:00

gpg: Print number of good signatures with --check-sigs.

* g10/keylist.c (keylist_context): Add field good_sigs.
(list_keyblock_print): Updated good_sigs.
(print_signature_stats): Print number of good signatures and use
log_info instead of tty_printf.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-06-20 15:05:32 +02:00
parent 6500f338a3
commit 0948c4f217
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -53,6 +53,7 @@ static void print_card_serialno (const char *serialno);
struct keylist_context struct keylist_context
{ {
int check_sigs; /* If set signatures shall be verified. */ int check_sigs; /* If set signatures shall be verified. */
int good_sigs; /* Counter used if CHECK_SIGS is set. */
int inv_sigs; /* Counter used if CHECK_SIGS is set. */ int inv_sigs; /* Counter used if CHECK_SIGS is set. */
int no_key; /* Counter used if CHECK_SIGS is set. */ int no_key; /* Counter used if CHECK_SIGS is set. */
int oth_err; /* Counter used if CHECK_SIGS is set. */ int oth_err; /* Counter used if CHECK_SIGS is set. */
@ -439,19 +440,25 @@ print_signature_stats (struct keylist_context *s)
if (!s->check_sigs) if (!s->check_sigs)
return; /* Signature checking was not requested. */ return; /* Signature checking was not requested. */
if (s->good_sigs == 1)
log_info (_("1 good signature\n"));
else if (s->good_sigs)
log_info (_("%d good signatures\n"), s->good_sigs);
if (s->inv_sigs == 1) if (s->inv_sigs == 1)
tty_printf (_("1 bad signature\n")); log_info (_("1 bad signature\n"));
else if (s->inv_sigs) else if (s->inv_sigs)
tty_printf (_("%d bad signatures\n"), s->inv_sigs); log_info (_("%d bad signatures\n"), s->inv_sigs);
if (s->no_key == 1) if (s->no_key == 1)
tty_printf (_("1 signature not checked due to a missing key\n")); log_info (_("1 signature not checked due to a missing key\n"));
else if (s->no_key) else if (s->no_key)
tty_printf (_("%d signatures not checked due to missing keys\n"), log_info (_("%d signatures not checked due to missing keys\n"), s->no_key);
s->no_key);
if (s->oth_err == 1) if (s->oth_err == 1)
tty_printf (_("1 signature not checked due to an error\n")); log_info (_("1 signature not checked due to an error\n"));
else if (s->oth_err) else if (s->oth_err)
tty_printf (_("%d signatures not checked due to errors\n"), s->oth_err); log_info (_("%d signatures not checked due to errors\n"), s->oth_err);
} }
@ -1138,6 +1145,7 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr,
switch (gpg_err_code (rc)) switch (gpg_err_code (rc))
{ {
case 0: case 0:
listctx->good_sigs++;
sigrc = '!'; sigrc = '!';
break; break;
case GPG_ERR_BAD_SIGNATURE: case GPG_ERR_BAD_SIGNATURE: