]> the.earth.li Git - onak.git/commitdiff
Handle signature revokations better.
authorJonathan McDowell <noodles@earth.li>
Wed, 2 Mar 2005 12:18:19 +0000 (12:18 +0000)
committerJonathan McDowell <noodles@earth.li>
Wed, 2 Mar 2005 12:18:19 +0000 (12:18 +0000)
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.

keyindex.c
merge.c

index d6d62e0e39ee31a25ab4d24718b7ecbd1f6d2215..c043fa4cfdd1f293b69f42bf0bb75e6c721c8a02 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Jonathan McDowell <noodles@earth.li>
  *
- * Copyright 2002 Project Purple
+ * Copyright 2002-2005 Project Purple
  */
 
 #include <inttypes.h>
@@ -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         <a href=\"lookup?op=get&"
+                       printf("%s         <a href=\"lookup?op=get&"
                                "search=%08llX\">%08llX</a>             "
                                "<a href=\"lookup?op=vindex&search=0x%08llX\">"
                                "%s</a>\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 95abbbafbf8d6e663367d34fc68c9ff7e638ccee..43795966d848cf41e14f42be5127106c667b185b 100644 (file)
--- a/merge.c
+++ b/merge.c
@@ -3,7 +3,7 @@
  *
  * Jonathan McDowell <noodles@earth.li>
  *
- * Copyright 2002-2004 Project Purple
+ * Copyright 2002-2005 Project Purple
  */
 
 #include <stdio.h>
@@ -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));
+       }
 }
 
 /**