aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keyedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/keyedit.c')
-rw-r--r--g10/keyedit.c80
1 files changed, 74 insertions, 6 deletions
diff --git a/g10/keyedit.c b/g10/keyedit.c
index f5597560d..b5c4ac5a9 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -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(