exit(EXIT_SUCCESS);
}
- pid = setsid();
+ setsid();
freopen("/dev/null", "r", stdin);
freopen("/dev/null", "w", stdout);
if (ret != -1) {
ret = listen(fd, 5);
+ if (ret == -1) {
+ close(fd);
+ fd = -1;
+ }
}
-
+
return fd;
}
ssize_t count = 0;
int ret = 0;
uint64_t keyid = 0;
- uint8_t fp[MAX_FINGERPRINT_LEN];
char *search = NULL;
struct openpgp_publickey *key = NULL;
struct openpgp_packet_list *packets = NULL;
struct openpgp_packet_list *list_end = NULL;
struct buffer_ctx storebuf;
struct skshash hash;
+ struct openpgp_fingerprint fingerprint;
/*
* Get the command from the client.
if (bytes > MAX_FINGERPRINT_LEN) {
ret = 1;
} else {
- read(fd, fp, bytes);
+ fingerprint.length = bytes;
+ read(fd, fingerprint.fp, bytes);
}
storebuf.offset = 0;
if (ret == 0) {
"Fetching by fingerprint"
", result: %d",
dbctx->fetch_key_fp(dbctx,
- fp, bytes,
+ &fingerprint,
&key, false));
if (key != NULL) {
storebuf.size = 8192;
while ((optchar = getopt(argc, argv, "c:fh")) != -1 ) {
switch (optchar) {
case 'c':
+ if (configfile != NULL) {
+ free(configfile);
+ }
configfile = strdup(optarg);
break;
case 'f':