commit 4abf001684538854fb31ed5aaa1d3019da241d06
parent 0b71c907f1b957781c5850a7445e3fd6abbdfb43
Author: sin <sin@2f30.org>
Date: Sun, 12 May 2019 20:39:08 +0100
Die early if encryption key is not provided
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/dup-init.c b/dup-init.c
@@ -6,6 +6,7 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+#include <strings.h>
#include <unistd.h>
#include "arg.h"
@@ -104,6 +105,10 @@ main(int argc, char *argv[])
usage();
};
+ if (strcasecmp(param.ealgo, "XChaCha20-Poly1305") == 0 &&
+ keyfile == NULL)
+ errx(1, "expected encryption key");
+
if (snprintf(spath, sizeof(spath), "%s/%s",
repo, ARCHIVEPATH) >= sizeof(spath))
errx(1, "snprintf: %s: path too long", spath);