X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=hashquery.c;h=965eaf9d19ab233c5b6c7b674d6b7237aff6122e;hb=ff3b87253171dc8b76ec26b70ba738a2d3a603ac;hp=478c20f9453bc5c327353fdba6a585c4b395947f;hpb=5e1b22d763640c4d7a09d07920403d8d491b4410;p=onak.git diff --git a/hashquery.c b/hashquery.c index 478c20f..965eaf9 100644 --- a/hashquery.c +++ b/hashquery.c @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) uint8_t **hashes; struct buffer_ctx cgipostbuf; struct openpgp_publickey **keys; + struct onak_dbctx *dbctx; readconfig(NULL); initlogthing("hashquery", config.logfile); @@ -88,15 +89,16 @@ int main(int argc, char *argv[]) doerror("Couldn't allocate memory for reply.\n"); } - if (config.dbbackend->fetch_key_skshash == NULL) { + catchsignals(); + dbctx = config.dbinit(false); + + if (dbctx->fetch_key_skshash == NULL) { + dbctx->cleanupdb(dbctx); doerror("Can't fetch by skshash with this backend."); } - catchsignals(); - config.dbbackend->initdb(false); - for (i = 0; i < count; i++) { - config.dbbackend->fetch_key_skshash( + dbctx->fetch_key_skshash(dbctx, (struct skshash *) hashes[i], &keys[found]); if (keys[found] != NULL) { found++; @@ -107,7 +109,7 @@ int main(int argc, char *argv[]) free(hashes); hashes = NULL; - config.dbbackend->cleanupdb(); + dbctx->cleanupdb(dbctx); puts("Content-Type: pgp/keys\n"); marshal_array(stdout_putchar, NULL,