}
break;
case KEYD_CMD_STORE:
+ case KEYD_CMD_UPDATE:
if (!keyd_write_reply(fd, KEYD_REPLY_OK)) {
ret = 1;
}
&packets,
0);
parse_keys(packets, &key);
- dbctx->store_key(dbctx, key, false, false);
+ dbctx->store_key(dbctx, key, false,
+ (cmd == KEYD_CMD_UPDATE));
free_packet_list(packets);
packets = NULL;
free_publickey(key);
KEYD_CMD_STATS,
KEYD_CMD_GET_SKSHASH,
KEYD_CMD_GET_FP,
+ KEYD_CMD_UPDATE,
KEYD_CMD_LAST /* Placeholder */
};
/**
* @brief Version of the keyd protocol currently supported
*/
-static const uint32_t keyd_version = 4;
+static const uint32_t keyd_version = 5;
/**
* @brief Response structure for the @a KEYD_CMD_STATS response
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.");
}
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);
stats.command_stats[KEYD_CMD_STORE]);
printf(" Delete key: %d\n",
stats.command_stats[KEYD_CMD_DELETE]);
+ printf(" Update key: %d\n",
+ stats.command_stats[KEYD_CMD_UPDATE]);
printf(" Search key: %d\n",
stats.command_stats[KEYD_CMD_GET_TEXT]);
printf(" Get full keyid: %d\n",