X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/e3ee7975fc8f8b343390272663b8c644030b17c1..576754568dc383e78065e88e05eeb2d078524f9c:/keydb.c?ds=sidebyside diff --git a/keydb.c b/keydb.c index 406f857..347b406 100644 --- a/keydb.c +++ b/keydb.c @@ -4,6 +4,8 @@ * Jonathan McDowell * * Copyright 2002 Project Purple + * + * $Id: keydb.c,v 1.9 2003/06/04 20:57:08 noodles Exp $ */ /** @@ -95,29 +97,22 @@ struct ll *getkeysigs(uint64_t keyid) struct ll *cached_getkeysigs(uint64_t keyid) { struct stats_key *key = NULL; + struct stats_key *signedkey = NULL; + struct ll *cursig = NULL; if (keyid == 0) { return NULL; } - key = findinhash(keyid); - if (key == NULL) { - key = malloc(sizeof(*key)); - if (key != NULL) { - key->keyid = keyid; - key->colour = 0; - key->parent = 0; - key->sigs = NULL; - key->gotsigs = false; - key->disabled = false; - addtohash(key); - } else { - perror("cached_getkeysigs()"); - return NULL; - } - } + key = createandaddtohash(keyid); + if (key->gotsigs == false) { key->sigs = getkeysigs(key->keyid); + for (cursig = key->sigs; cursig != NULL; + cursig = cursig->next) { + signedkey = (struct stats_key *) cursig->object; + signedkey->signs = lladd(signedkey->signs, key); + } key->gotsigs = true; }