commit 86e037e9f1ee5d564daa67fae8f4cc6fd8bc19d6 parent ba06cd1fc2b7c9c50147f5af8898e524cfb741b6 Author: sin <sin@2f30.org> Date: Fri, 17 May 2019 14:30:43 +0300 Check a key is provided when snapshots are encrypted Diffstat:
M | snap.c | | | 6 | ++++++ |
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/snap.c b/snap.c @@ -283,6 +283,12 @@ sopen(char *path, int flags, int mode, struct sctx **sctx) return -1; } + /* Ensure a key has been provided if caller requested encryption */ + if (type != SNONETYPE && !param.keyloaded) { + seterr("expected encryption key"); + return -1; + } + if (sodium_init() < 0) { seterr("sodium_init: failed"); return -1;