X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/b8790eaafd4ed0be8ab280581dedd3ff81ba752b..0fac914c0876bf3cf78c12ea0b9b44880fbdffa4:/keyd.c?ds=sidebyside diff --git a/keyd.c b/keyd.c index eab3b54..919b61b 100644 --- a/keyd.c +++ b/keyd.c @@ -125,7 +125,7 @@ int sock_init(const char *sockname) int sock_do(int fd) { - int cmd = KEYD_CMD_UNKNOWN; + uint32_t cmd = KEYD_CMD_UNKNOWN; ssize_t bytes = 0; ssize_t count = 0; int ret = 0; @@ -152,6 +152,8 @@ int sock_do(int fd) case KEYD_CMD_VERSION: cmd = KEYD_REPLY_OK; write(fd, &cmd, sizeof(cmd)); + cmd = sizeof(keyd_version); + write(fd, &cmd, sizeof(cmd)); write(fd, &keyd_version, sizeof(keyd_version)); break; case KEYD_CMD_GET: @@ -311,6 +313,8 @@ int sock_do(int fd) } if (ret == 0) { keyid = config.dbbackend->getfullkeyid(keyid); + cmd = sizeof(keyid); + write(fd, &cmd, sizeof(cmd)); write(fd, &keyid, sizeof(keyid)); } break; @@ -323,9 +327,14 @@ int sock_do(int fd) write(fd, &bytes, sizeof(bytes)); break; case KEYD_CMD_CLOSE: + cmd = KEYD_REPLY_OK; + write(fd, &cmd, sizeof(cmd)); ret = 1; break; case KEYD_CMD_QUIT: + cmd = KEYD_REPLY_OK; + write(fd, &cmd, sizeof(cmd)); + ret = 1; trytocleanup(); break; default: