X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=cgi%2Flookup.c;h=2006e475cea9d70dba5c90aef601a93fc4a0f51e;hb=9aadc77b48c7826015f8ec87cebdc15d012c5f14;hp=35c039bf906c8c9d59e8706e052261f9dd481cc9;hpb=3877403043acfbfa57497d3ba51a5ec2db1c77dc;p=onak.git diff --git a/cgi/lookup.c b/cgi/lookup.c index 35c039b..2006e47 100644 --- a/cgi/lookup.c +++ b/cgi/lookup.c @@ -50,7 +50,7 @@ void find_keys(struct onak_dbctx *dbctx, char *search, uint64_t keyid, struct openpgp_fingerprint *fingerprint, bool ishex, bool isfp, bool dispfp, bool skshash, - bool exact, bool verbose, bool mrhkp) + __unused bool exact, bool verbose, bool mrhkp) { struct openpgp_publickey *publickey = NULL; int count = 0; @@ -228,6 +228,11 @@ int main(int argc, char *argv[]) initlogthing("lookup", config.logfile); catchsignals(); dbctx = config.dbinit(config.backend, false); + if (dbctx == NULL) { + logthing(LOGTHING_ERROR, + "Failed to open key database."); + goto err; + } switch (op) { case OP_GET: case OP_HGET: @@ -252,7 +257,8 @@ int main(int argc, char *argv[]) result, search); puts("
");
-				cleankeys(&publickey, config.clean_policies);
+				cleankeys(dbctx, &publickey,
+						config.clean_policies);
 				flatten_publickey(publickey,
 							&packets,
 							&list_end);
@@ -304,6 +310,7 @@ int main(int argc, char *argv[])
 			puts("Unknown operation!");
 		}
 		dbctx->cleanupdb(dbctx);
+err:
 		cleanuplogthing();
 		cleanupconfig();
 	}