fixes a segfault when full encryption is requested during a put without specifying the key v1.1

Tue, 12 Dec 2017 23:36:47 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 12 Dec 2017 23:36:47 +0100
branch
v1.1
changeset 342
0b03aa8fb838
parent 341
7954fdacdb5c
child 343
b9c6e0be5774

fixes a segfault when full encryption is requested during a put without specifying the key

dav/main.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Tue Dec 12 17:41:01 2017 +0100
+++ b/dav/main.c	Tue Dec 12 23:36:47 2017 +0100
@@ -794,6 +794,14 @@
         }
     }
     
+    // if encryption is requested, but we still don't know the key, abort
+    if (DAV_IS_ENCRYPTED(sn) && !(sn->key)) {
+        fprintf(stderr, "Encryption has been requested, "
+                "but no default key is configured.\n"
+                "You may specify a custom key with the '-k' option.\n");
+        return -1;
+    }
+    
     int ret;
     if(!strcmp(file, "-")) {
         FILE *in = stdin;

mercurial