X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=cgi%2Fadd.c;h=90824ccce7b5715b9c350f693e42ab6a05f06029;hb=9aadc77b48c7826015f8ec87cebdc15d012c5f14;hp=02eb3eb00703a1bca1bff3e4b20b10e8cb37f304;hpb=a94e29c9a3763f96b1c773f0818b97e4fd0777b0;p=onak.git diff --git a/cgi/add.c b/cgi/add.c index 02eb3eb..90824cc 100644 --- a/cgi/add.c +++ b/cgi/add.c @@ -87,13 +87,20 @@ int main(int argc, char *argv[]) } catchsignals(); dbctx = config.dbinit(config.backend, false); - - count = cleankeys(&keys, config.clean_policies); + if (dbctx == NULL) { + logthing(LOGTHING_ERROR, + "Failed to open key database."); + goto err; + } + + count = cleankeys(dbctx, &keys, config.clean_policies); logthing(LOGTHING_INFO, "%d keys cleaned.", count); count = dbctx->update_keys(dbctx, &keys, - &config.blacklist, true); + &config.blacklist, + config.clean_policies & ONAK_CLEAN_UPDATE_ONLY, + true); logthing(LOGTHING_NOTICE, "Got %d new keys.", count); @@ -107,6 +114,7 @@ int main(int argc, char *argv[]) puts("No OpenPGP packets found in input."); end_html(); } +err: cleanuplogthing(); cleanupconfig(); }