mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* main.h, keylist.c (print_subpackets_colon): Make a public function.
* keyedit.c (print_and_check_one_sig_colon): New. Print a with-colons version of the sig record. (menu_delsig): Call it here for a with-colons delsig.
This commit is contained in:
parent
e7c94128b2
commit
b7be7d59b1
4 changed files with 85 additions and 7 deletions
|
@ -94,6 +94,71 @@ struct sign_attrib {
|
|||
char *trust_regexp;
|
||||
};
|
||||
|
||||
|
||||
/* TODO: Fix duplicated code between here and the check-sigs/list-sigs
|
||||
code in keylist.c. */
|
||||
static int
|
||||
print_and_check_one_sig_colon( KBNODE keyblock, KBNODE node,
|
||||
int *inv_sigs, int *no_key, int *oth_err,
|
||||
int *is_selfsig, int print_without_key )
|
||||
{
|
||||
PKT_signature *sig = node->pkt->pkt.signature;
|
||||
int rc, sigrc;
|
||||
|
||||
/* TODO: Make sure a cached sig record here still has the pk that
|
||||
issued it. See also keylist.c:list_keyblock_print */
|
||||
|
||||
switch((rc=check_key_signature(keyblock,node,is_selfsig)))
|
||||
{
|
||||
case 0:
|
||||
node->flag &= ~(NODFLG_BADSIG|NODFLG_NOKEY|NODFLG_SIGERR);
|
||||
sigrc = '!';
|
||||
break;
|
||||
case G10ERR_BAD_SIGN:
|
||||
node->flag = NODFLG_BADSIG;
|
||||
sigrc = '-';
|
||||
if( inv_sigs )
|
||||
++*inv_sigs;
|
||||
break;
|
||||
case G10ERR_NO_PUBKEY:
|
||||
case G10ERR_UNU_PUBKEY:
|
||||
node->flag = NODFLG_NOKEY;
|
||||
sigrc = '?';
|
||||
if( no_key )
|
||||
++*no_key;
|
||||
break;
|
||||
default:
|
||||
node->flag = NODFLG_SIGERR;
|
||||
sigrc = '%';
|
||||
if( oth_err )
|
||||
++*oth_err;
|
||||
break;
|
||||
}
|
||||
|
||||
if( sigrc != '?' || print_without_key )
|
||||
{
|
||||
printf("sig:%c::%d:%08lX%08lX:%lu:%lu:",
|
||||
sigrc,sig->pubkey_algo,(ulong)sig->keyid[1],(ulong)sig->keyid[2],
|
||||
(ulong)sig->timestamp,(ulong)sig->expiredate);
|
||||
|
||||
if(sig->trust_depth || sig->trust_value)
|
||||
printf("%d %d",sig->trust_depth,sig->trust_value);
|
||||
|
||||
printf(":");
|
||||
|
||||
if(sig->trust_regexp)
|
||||
print_string(stdout,sig->trust_regexp,strlen(sig->trust_regexp),':');
|
||||
|
||||
printf("::%02x%c\n",sig->sig_class,sig->flags.exportable?'x':'l');
|
||||
|
||||
if(opt.show_subpackets)
|
||||
print_subpackets_colon(sig);
|
||||
}
|
||||
|
||||
return (sigrc == '!');
|
||||
}
|
||||
|
||||
|
||||
/****************
|
||||
* Print information about a signature, check it and return true
|
||||
* if the signature is okay. NODE must be a signature packet.
|
||||
|
@ -255,8 +320,6 @@ check_all_keysigs( KBNODE keyblock, int only_selected )
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int
|
||||
sign_mk_attrib( PKT_signature *sig, void *opaque )
|
||||
{
|
||||
|
@ -2534,10 +2597,15 @@ menu_delsig( KBNODE pub_keyblock )
|
|||
tty_print_utf8_string( uid->name, uid->len );
|
||||
tty_printf("\n");
|
||||
|
||||
okay = inv_sig = no_key = other_err = 0;
|
||||
valid = print_and_check_one_sig( pub_keyblock, node,
|
||||
&inv_sig, &no_key, &other_err,
|
||||
&selfsig, 1 );
|
||||
okay = inv_sig = no_key = other_err = 0;
|
||||
if(opt.with_colons)
|
||||
valid = print_and_check_one_sig_colon( pub_keyblock, node,
|
||||
&inv_sig, &no_key, &other_err,
|
||||
&selfsig, 1 );
|
||||
else
|
||||
valid = print_and_check_one_sig( pub_keyblock, node,
|
||||
&inv_sig, &no_key, &other_err,
|
||||
&selfsig, 1 );
|
||||
|
||||
if( valid ) {
|
||||
okay = cpr_get_answer_yes_no_quit(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue