1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-22 01:12:45 +02:00

gpg: Split print_and_check_one_sig.

* g10/keyedit.c (print_and_check_one_sig): Split the print
functionality into...
(print_one_sig): ... this new function.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2016-02-19 15:13:22 +01:00
parent ac5aea9545
commit 5fbd80579a

View File

@ -1,7 +1,7 @@
/* keyedit.c - Edit properties of a key /* keyedit.c - Edit properties of a key
* Copyright (C) 1998-2010 Free Software Foundation, Inc. * Copyright (C) 1998-2010 Free Software Foundation, Inc.
* Copyright (C) 1998-2015 Werner Koch * Copyright (C) 1998-2015 Werner Koch
* Copyright (C) 2015 g10 Code GmbH * Copyright (C) 2015, 2016 g10 Code GmbH
* *
* This file is part of GnuPG. * This file is part of GnuPG.
* *
@ -189,24 +189,23 @@ print_and_check_one_sig_colon (KBNODE keyblock, KBNODE node,
/* /*
* Print information about a signature, check it and return true if * Print information about a signature (rc is its status), check it
* the signature is okay. NODE must be a signature packet. With * and return true if the signature is okay. NODE must be a signature
* EXTENDED set all possible signature list options will always be * packet. With EXTENDED set all possible signature list options will
* printed. * always be printed.
*/ */
static int static int
print_and_check_one_sig (KBNODE keyblock, KBNODE node, print_one_sig (int rc, KBNODE keyblock, KBNODE node,
int *inv_sigs, int *no_key, int *oth_err, int *inv_sigs, int *no_key, int *oth_err,
int *is_selfsig, int print_without_key, int extended) int is_selfsig, int print_without_key, int extended)
{ {
PKT_signature *sig = node->pkt->pkt.signature; PKT_signature *sig = node->pkt->pkt.signature;
int rc, sigrc; int sigrc;
int is_rev = sig->sig_class == 0x30; int is_rev = sig->sig_class == 0x30;
/* TODO: Make sure a cached sig record here still has the pk that /* TODO: Make sure a cached sig record here still has the pk that
issued it. See also keylist.c:list_keyblock_print */ issued it. See also keylist.c:list_keyblock_print */
rc = check_key_signature (keyblock, node, is_selfsig);
switch (gpg_err_code (rc)) switch (gpg_err_code (rc))
{ {
case 0: case 0:
@ -257,7 +256,7 @@ print_and_check_one_sig (KBNODE keyblock, KBNODE node,
tty_printf ("[%s] ", gpg_strerror (rc)); tty_printf ("[%s] ", gpg_strerror (rc));
else if (sigrc == '?') else if (sigrc == '?')
; ;
else if (*is_selfsig) else if (is_selfsig)
{ {
tty_printf (is_rev ? _("[revocation]") : _("[self-signature]")); tty_printf (is_rev ? _("[revocation]") : _("[self-signature]"));
if (extended && sig->flags.chosen_selfsig) if (extended && sig->flags.chosen_selfsig)
@ -311,6 +310,16 @@ print_and_check_one_sig (KBNODE keyblock, KBNODE node,
return (sigrc == '!'); return (sigrc == '!');
} }
static int
print_and_check_one_sig (KBNODE keyblock, KBNODE node,
int *inv_sigs, int *no_key, int *oth_err,
int *is_selfsig, int print_without_key, int extended)
{
return print_one_sig (check_key_signature (keyblock, node, is_selfsig),
keyblock, node, inv_sigs, no_key, oth_err,
*is_selfsig, print_without_key, extended);
}
/* /*