From 9cff08f92a96ed9ba182db3fa59a0ce516a50740 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Sat, 16 Jul 2005 11:48:20 +0000 Subject: [PATCH 1/1] Support 16 digit key ids in lookup. When generating our html keyindexes, use 64bit key ids for the links, to help avoid collisions. Also make lookup support this length of id. --- keyindex.c | 24 ++++++++++++------------ lookup.c | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/keyindex.c b/keyindex.c index c043fa4..0732a11 100644 --- a/keyindex.c +++ b/keyindex.c @@ -40,13 +40,13 @@ int list_sigs(struct openpgp_packet_list *sigs, bool html) } if (html && uid != NULL) { printf("%s %08llX " - "" + "search=%016llX\">%08llX " + "" "%s\n", sig, + sigid, sigid & 0xFFFFFFFF, - sigid & 0xFFFFFFFF, - sigid & 0xFFFFFFFF, + sigid, txt2html(uid)); } else if (html && uid == NULL) { printf("%s %08llX " @@ -231,25 +231,25 @@ int key_index(struct openpgp_publickey *keys, bool verbose, bool fingerprint, keys->publickey->data[0]); } - keyid = (get_keyid(keys) & 0xFFFFFFFF); + keyid = get_keyid(keys); if (html) { printf("pub %5d%c/%08X %04d/%02d/%02d ", + "search=%016llX\">%08llX %04d/%02d/%02d ", length, (type == 1) ? 'R' : ((type == 16) ? 'g' : ((type == 17) ? 'D' : '?')), - (uint32_t) keyid, - (uint32_t) keyid, + keyid, + keyid & 0xFFFFFFFF, created->tm_year + 1900, created->tm_mon + 1, created->tm_mday); } else { - printf("pub %5d%c/%08X %04d/%02d/%02d ", + printf("pub %5d%c/%08llX %04d/%02d/%02d ", length, (type == 1) ? 'R' : ((type == 16) ? 'g' : ((type == 17) ? 'D' : '?')), - (uint32_t) keyid, + keyid & 0xFFFFFFFF, created->tm_year + 1900, created->tm_mon + 1, created->tm_mday); @@ -262,8 +262,8 @@ int key_index(struct openpgp_publickey *keys, bool verbose, bool fingerprint, curuid->packet->data); if (html) { printf("", - (uint32_t) keyid); + "search=0x%016llX\">", + keyid); } printf("%s%s%s\n", (html) ? txt2html(buf) : buf, diff --git a/lookup.c b/lookup.c index c3b4908..e5cd1ae 100644 --- a/lookup.c +++ b/lookup.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) search = params[i+1]; params[i+1] = NULL; if (search != NULL) { - keyid = strtoul(search, &end, 16); + keyid = strtoull(search, &end, 16); if (*search != 0 && end != NULL && *end == 0) { -- 2.39.5