client: xdg usage: place() vs find()

place() is used when creating a file, as it will create
intermediate directories, only use it when actually placing
a new file.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2020-07-08 10:42:05 +02:00
parent 3bad3e6e52
commit b65390ebc9
3 changed files with 32 additions and 23 deletions

View File

@ -677,13 +677,13 @@ fn keyfile_parameters(param: &Value) -> Result<(Option<PathBuf>, CryptMode), Err
Ok(match (keyfile, crypt_mode) {
// no parameters:
(None, None) => (key::optional_default_key_path()?, CryptMode::Encrypt),
(None, None) => (key::find_default_encryption_key()?, CryptMode::Encrypt),
// just --crypt-mode=none
(None, Some(CryptMode::None)) => (None, CryptMode::None),
// just --crypt-mode other than none
(None, Some(crypt_mode)) => match key::optional_default_key_path()? {
(None, Some(crypt_mode)) => match key::find_default_encryption_key()? {
None => bail!("--crypt-mode without --keyfile and no default key file available"),
Some(path) => (Some(path), crypt_mode),
}