From: Jonathan McDowell Date: Wed, 2 Mar 2005 12:18:19 +0000 (+0000) Subject: Handle signature revokations better. X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/abc90dd0602ca116ce61886e962aecd14d4459cc Handle signature revokations better. Hanna Wallach reported an issue with UID revokations. This was because we weren't allowing multiple signatures from the same keyid for a UID; we now check the signature type and allow them if they're different. --- diff --git a/keyindex.c b/keyindex.c index d6d62e0..c043fa4 100644 --- a/keyindex.c +++ b/keyindex.c @@ -3,7 +3,7 @@ * * Jonathan McDowell * - * Copyright 2002 Project Purple + * Copyright 2002-2005 Project Purple */ #include @@ -26,26 +26,37 @@ int list_sigs(struct openpgp_packet_list *sigs, bool html) { char *uid = NULL; uint64_t sigid = 0; + char *sig = NULL; while (sigs != NULL) { sigid = sig_keyid(sigs->packet); uid = keyid2uid(sigid); + if (sigs->packet->data[0] == 4 && + sigs->packet->data[1] == 0x30) { + /* It's a Type 4 sig revocation */ + sig = "rev"; + } else { + sig = "sig"; + } if (html && uid != NULL) { - printf("sig %08llX " "" "%s\n", + sig, sigid & 0xFFFFFFFF, sigid & 0xFFFFFFFF, sigid & 0xFFFFFFFF, txt2html(uid)); } else if (html && uid == NULL) { - printf("sig %08llX " + printf("%s %08llX " "[User id not found]\n", + sig, sigid & 0xFFFFFFFF); } else { - printf("sig %08llX" + printf("%s %08llX" " %s\n", + sig, sigid & 0xFFFFFFFF, (uid != NULL) ? uid : "[User id not found]"); diff --git a/merge.c b/merge.c index 95abbba..4379596 100644 --- a/merge.c +++ b/merge.c @@ -3,7 +3,7 @@ * * Jonathan McDowell * - * Copyright 2002-2004 Project Purple + * Copyright 2002-2005 Project Purple */ #include @@ -43,7 +43,16 @@ bool compare_packets(struct openpgp_packet *a, struct openpgp_packet *b) */ bool compare_signatures(struct openpgp_packet *a, struct openpgp_packet *b) { - return (sig_keyid(a) == sig_keyid(b)); + if (a->data[0] != b->data[0]) { + /* Different signature versions, so not the same */ + return false; + } else if (a->data[0] == 4 && a->data[1] != b->data[1]) { + /* Type 4 signature, but different types */ + return false; + /* TODO: Check signature time? */ + } else { + return (sig_keyid(a) == sig_keyid(b)); + } } /**