]> the.earth.li Git - onak.git/blobdiff - cgi/add.c
0.6.3 release
[onak.git] / cgi / add.c
index 02eb3eb00703a1bca1bff3e4b20b10e8cb37f304..90824ccce7b5715b9c350f693e42ab6a05f06029 100644 (file)
--- 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();
        }