binary = true;
break;
case 'c':
+ if (configfile != NULL) {
+ free(configfile);
+ }
configfile = strdup(optarg);
break;
case 'e':
usage();
} else if (!strcmp("dump", argv[optind])) {
dbctx = config.dbinit(config.backend, true);
+ if (dbctx == NULL) {
+ logthing(LOGTHING_ERROR,
+ "Failed to open key database.");
+ rc = EXIT_FAILURE;
+ goto err;
+ }
dumpstate.count = dumpstate.filenum = 0;
dumpstate.maxcount = 100000;
dumpstate.fd = -1;
result);
dbctx = config.dbinit(config.backend, false);
+ if (dbctx == NULL) {
+ logthing(LOGTHING_ERROR,
+ "Failed to open key database.");
+ rc = EXIT_FAILURE;
+ goto err;
+ }
result = cleankeys(dbctx, &keys,
config.clean_policies);
logthing(LOGTHING_INFO, "%d keys cleaned.",
}
} else if (!strcmp("clean", argv[optind])) {
dbctx = config.dbinit(config.backend, true);
+ if (dbctx == NULL) {
+ logthing(LOGTHING_ERROR,
+ "Failed to open key database.");
+ rc = EXIT_FAILURE;
+ goto err;
+ }
if (binary) {
result = read_openpgp_stream(stdin_getchar, NULL,
&packets, 0);
}
}
dbctx = config.dbinit(config.backend, false);
+ if (dbctx == NULL) {
+ logthing(LOGTHING_ERROR,
+ "Failed to open key database.");
+ rc = EXIT_FAILURE;
+ goto err;
+ }
if (!strcmp("index", argv[optind])) {
find_keys(dbctx, search, keyid, &fingerprint, ishex,
isfp, dispfp, skshash,
usage();
}
+err:
cleanuplogthing();
cleanupconfig();
free(configfile);