From 18cf6c9f2755f94aa98c4ccbacf84e39382bbe73 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 24 Jul 2020 16:47:47 +0200 Subject: [PATCH] config: add hint for set encryption key, die on unlink error as else the API cannot easily know if this is set, it cannot check with -f as the key is in a restricted area and we do not want that a GET runs as protected. Signed-off-by: Thomas Lamprecht --- PVE/Storage/PBSPlugin.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PVE/Storage/PBSPlugin.pm b/PVE/Storage/PBSPlugin.pm index 2dc0a18..fa966d9 100644 --- a/PVE/Storage/PBSPlugin.pm +++ b/PVE/Storage/PBSPlugin.pm @@ -114,6 +114,7 @@ sub pbs_delete_encryption_key { my $pwfile = pbs_encryption_key_file_name($scfg, $storeid); unlink $pwfile; + delete $scfg->{'encryption-key'}; } sub pbs_get_encryption_key { @@ -355,6 +356,7 @@ sub on_add_hook { } else { pbs_set_encryption_key($scfg, $storeid, $encryption_key); } + $scfg->{'encryption-key'} = 1; } else { pbs_delete_encryption_key($scfg, $storeid); } @@ -378,6 +380,7 @@ sub on_update_hook { } else { pbs_set_encryption_key($scfg, $storeid, $encryption_key); } + $scfg->{'encryption-key'} = 1; } else { pbs_delete_encryption_key($scfg, $storeid); }