fix -c option for dav rm command

Sat, 23 Nov 2019 11:46:45 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 23 Nov 2019 11:46:45 +0100
changeset 683
53bcb5e47220
parent 682
a7072ebb1ce0
child 684
a4b4257c1a5f

fix -c option for dav rm command

dav/main.c file | annotate | diff | comparison | revisions
--- a/dav/main.c	Wed Nov 20 12:17:55 2019 +0100
+++ b/dav/main.c	Sat Nov 23 11:46:45 2019 +0100
@@ -1577,7 +1577,9 @@
 static int cmd_operation_on_resources(CmdArgs* a,
                                       int(*operation)(DavResource*),
                                       const char* command,
-                                      const char* message) {
+                                      const char* message,
+                                      DavBool check_key)
+{
     if(a->argc < 1) {
         fprintf(stderr, "Too few arguments\n");
         fprintf(stderr, "Usage: dav %s\n", find_usage_str(command));
@@ -1598,7 +1600,7 @@
     
     set_session_lock(sn, a);
     
-    if(check_encryption_key(a, sn)) {
+    if(check_key && check_encryption_key(a, sn)) {
         goto cmd_oponres_exit;
     }
     
@@ -1634,12 +1636,12 @@
 
 int cmd_remove(CmdArgs *a) {
     return cmd_operation_on_resources(a, dav_delete,
-            "remove", "delete resource");
+            "remove", "delete resource", FALSE);
 }
 
 int cmd_mkdir(CmdArgs *a) {
     return cmd_operation_on_resources(a, dav_create_col,
-            "mkdir", "create collection");
+            "mkdir", "create collection", TRUE);
 }
 
 int cmd_move(CmdArgs *a, int cp) {

mercurial