]> git.sommitrealweird.co.uk Git - onak.git/blobdiff - keydb.c
cscvs to tla changeset 79
[onak.git] / keydb.c
diff --git a/keydb.c b/keydb.c
index 406f857147aa29391083db351b3f77d36430c338..347b406bd7daf0a61fd23280132192bf7983567c 100644 (file)
--- a/keydb.c
+++ b/keydb.c
@@ -4,6 +4,8 @@
  * Jonathan McDowell <noodles@earth.li>
  *
  * 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;
        }