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

gpg: New command --quick-revoke-sig

* g10/gpg.c (enum cmd_and_opt_values): Add aQuickRevSig.
(opts): Add --quick-revoke-sig.
(main): Implement.
* g10/keyedit.c (quick_find_keyblock): Add arg 'want_secret' and
adjust all callers.
(keyedit_quick_revsig): new.
* g10/revoke.c (get_default_sig_revocation_reason): New.
* g10/keylist.c (cmp_signodes): New.
--

GnuPG-bug-id: 5093
Backported-from-master: 243f9176e7
This commit is contained in:
Werner Koch 2020-10-28 17:06:27 +01:00
parent 38040ffee8
commit 7ec56b0336
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
7 changed files with 334 additions and 8 deletions

View file

@ -893,6 +893,51 @@ dump_attribs (const PKT_user_id *uid, PKT_public_key *pk)
}
/* Order two signatures. We first order by keyid and then by creation
* time. This is currently only used in keyedit.c */
int
cmp_signodes (const void *av, const void *bv)
{
const kbnode_t an = *(const kbnode_t *)av;
const kbnode_t bn = *(const kbnode_t *)bv;
const PKT_signature *a;
const PKT_signature *b;
int i;
/* log_assert (an->pkt->pkttype == PKT_SIGNATURE); */
/* log_assert (bn->pkt->pkttype == PKT_SIGNATURE); */
a = an->pkt->pkt.signature;
b = bn->pkt->pkt.signature;
/* Self-signatures are ordered first. */
if ((an->flag & NODFLG_MARK_B) && !(bn->flag & NODFLG_MARK_B))
return -1;
if (!(an->flag & NODFLG_MARK_B) && (bn->flag & NODFLG_MARK_B))
return 1;
/* then the keyids. (which are or course the same for self-sigs). */
i = keyid_cmp (a->keyid, b->keyid);
if (i)
return i;
/* Followed by creation time */
if (a->timestamp > b->timestamp)
return 1;
if (a->timestamp < b->timestamp)
return -1;
/* followed by the class in a way that a rev comes first. */
if (a->sig_class > b->sig_class)
return 1;
if (a->sig_class < b->sig_class)
return -1;
/* To make the sort stable we compare the entire structure as last resort. */
return memcmp (a, b, sizeof *a);
}
static void
list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr,
struct keylist_context *listctx)