]> the.earth.li Git - onak.git/blobdiff - keydb_keyd.c
Cleanup various includes
[onak.git] / keydb_keyd.c
index 6836e9a2db02cbbe28d22b1a123a2103ee56da05..acbdcff14cb2d96fbbeaad66caa19cc27642a48a 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <stdbool.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -34,6 +36,7 @@
 #include "keystructs.h"
 #include "log.h"
 #include "mem.h"
+#include "onak.h"
 #include "onak-conf.h"
 #include "parsekey.h"
 
@@ -227,6 +230,7 @@ static int keyd_store_key(struct onak_dbctx *dbctx,
        struct openpgp_packet_list *list_end = NULL;
        struct openpgp_publickey   *next = NULL;
        uint64_t                    keyid;
+       enum keyd_ops               cmd = KEYD_CMD_STORE;
 
        if (get_keyid(publickey, &keyid) != ONAK_E_OK) {
                logthing(LOGTHING_ERROR, "Couldn't find key ID for key.");
@@ -234,10 +238,10 @@ static int keyd_store_key(struct onak_dbctx *dbctx,
        }
 
        if (update) {
-               keyd_delete_key(dbctx, keyid, false);
+               cmd = KEYD_CMD_UPDATE;
        }
 
-       if (keyd_send_cmd(keyd_fd, KEYD_CMD_STORE)) {
+       if (keyd_send_cmd(keyd_fd, cmd)) {
                keybuf.offset = 0;
                keybuf.size = 8192;
                keybuf.buffer = malloc(keybuf.size);