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 <t.lamprecht@proxmox.com>
This commit is contained in:
@ -114,6 +114,7 @@ sub pbs_delete_encryption_key {
|
|||||||
my $pwfile = pbs_encryption_key_file_name($scfg, $storeid);
|
my $pwfile = pbs_encryption_key_file_name($scfg, $storeid);
|
||||||
|
|
||||||
unlink $pwfile;
|
unlink $pwfile;
|
||||||
|
delete $scfg->{'encryption-key'};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub pbs_get_encryption_key {
|
sub pbs_get_encryption_key {
|
||||||
@ -355,6 +356,7 @@ sub on_add_hook {
|
|||||||
} else {
|
} else {
|
||||||
pbs_set_encryption_key($scfg, $storeid, $encryption_key);
|
pbs_set_encryption_key($scfg, $storeid, $encryption_key);
|
||||||
}
|
}
|
||||||
|
$scfg->{'encryption-key'} = 1;
|
||||||
} else {
|
} else {
|
||||||
pbs_delete_encryption_key($scfg, $storeid);
|
pbs_delete_encryption_key($scfg, $storeid);
|
||||||
}
|
}
|
||||||
@ -378,6 +380,7 @@ sub on_update_hook {
|
|||||||
} else {
|
} else {
|
||||||
pbs_set_encryption_key($scfg, $storeid, $encryption_key);
|
pbs_set_encryption_key($scfg, $storeid, $encryption_key);
|
||||||
}
|
}
|
||||||
|
$scfg->{'encryption-key'} = 1;
|
||||||
} else {
|
} else {
|
||||||
pbs_delete_encryption_key($scfg, $storeid);
|
pbs_delete_encryption_key($scfg, $storeid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user