]> the.earth.li Git - onak.git/blobdiff - stats.c
0.6.3 release
[onak.git] / stats.c
diff --git a/stats.c b/stats.c
index b9692744c2893338927b10146376c4534f5f2a22..59b42a574d4315634684d60bb525795d9d8663d1 100644 (file)
--- a/stats.c
+++ b/stats.c
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "cleanup.h"
-#include "getcgi.h"
 #include "hash.h"
 #include "keydb.h"
+#include "keyindex.h"
 #include "ll.h"
 #include "stats.h"
 
@@ -136,25 +137,22 @@ void dofindpath(struct onak_dbctx *dbctx,
                uint64_t have, uint64_t want, bool html, int count)
 {
        struct stats_key *keyinfoa, *keyinfob, *curkey;
-       uint64_t fullhave, fullwant;
        int rec;
        int pathnum;
        char *uid;
-
-       fullhave = dbctx->getfullkeyid(dbctx, have);
-       fullwant = dbctx->getfullkeyid(dbctx, want);
+       char buf[1024];
 
        /*
         * Make sure the keys we have and want are in the cache.
         */
-       (void) dbctx->cached_getkeysigs(dbctx, fullhave);
-       (void) dbctx->cached_getkeysigs(dbctx, fullwant);
+       (void) dbctx->cached_getkeysigs(dbctx, have);
+       (void) dbctx->cached_getkeysigs(dbctx, want);
 
-       if ((keyinfoa = findinhash(fullhave)) == NULL) {
+       if ((keyinfoa = findinhash(have)) == NULL) {
                printf("Couldn't find key 0x%016" PRIX64 ".\n", have);
                return;
        }
-       if ((keyinfob = findinhash(fullwant)) == NULL) {
+       if ((keyinfob = findinhash(want)) == NULL) {
                printf("Couldn't find key 0x%016" PRIX64 ".\n", want);
                return;
        }
@@ -203,7 +201,7 @@ void dofindpath(struct onak_dbctx *dbctx,
                                                "User id not found])%s<BR>\n",
                                                curkey->keyid,
                                                curkey->keyid,
-                                               (curkey->keyid == fullwant) ?
+                                               (curkey->keyid == want) ?
                                                        "" : " signs");
                                } else if (html && uid != NULL) {
                                        printf("<a href=\"lookup?op=get&search="
@@ -216,8 +214,9 @@ void dofindpath(struct onak_dbctx *dbctx,
                                                curkey->keyid,
                                                curkey->keyid,
                                                curkey->keyid,
-                                               txt2html(uid),
-                                               (curkey->keyid == fullwant) ?
+                                               html_escape(uid, strlen(uid),
+                                                       buf, sizeof(buf)),
+                                               (curkey->keyid == want) ?
                                                "" : " signs");
                                } else {
                                        printf("0x%016" PRIX64 " (%s)%s\n",
@@ -225,7 +224,7 @@ void dofindpath(struct onak_dbctx *dbctx,
                                                (uid == NULL) ?
                                                        "[User id not found]" :
                                                        uid,
-                                               (curkey->keyid == fullwant) ?
+                                               (curkey->keyid == want) ?
                                                "" : " signs");
                                }
                                if (uid != NULL) {