aboutsummaryrefslogtreecommitdiffstats
path: root/key2root-addkey.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-06-23 11:38:50 +0200
committerMattias Andrée <maandree@kth.se>2023-06-23 11:38:50 +0200
commite3556481ede823ec6b52065a832232fffd24b765 (patch)
tree0513080e9e7f3960a05a10d8a6a5ccde7f617c75 /key2root-addkey.c
parentAdd argument checks to key2root-addkey and key2root-rmkey (diff)
downloadkey2root-e3556481ede823ec6b52065a832232fffd24b765.tar.gz
key2root-e3556481ede823ec6b52065a832232fffd24b765.tar.bz2
key2root-e3556481ede823ec6b52065a832232fffd24b765.tar.xz
Fix minor mistakes i key2root-lskeys.c, implement key2root-rmkey.c, and minor work on key2root-addkey.c
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--key2root-addkey.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/key2root-addkey.c b/key2root-addkey.c
index d5ec701..c80ebbe 100644
--- a/key2root-addkey.c
+++ b/key2root-addkey.c
@@ -1,6 +1,10 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/mman.h>
+#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include "arg.h"
@@ -56,7 +60,14 @@ main(int argc, char *argv[])
if (failed)
return 1;
- /* TODO */
+ if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
+ fprintf(stderr, "%s: mlockall MCL_CURRENT|MCL_FUTURE: %s\n", argv0, strerror(errno));
+ exit(1);
+ }
+
+ /* TODO hash input */
+ /* TODO add or replace key */
+ /* TODO save changes, mode shall be 0700 */
return 0;
}