diff options
author | soruh <[email protected]> | 2023-02-02 22:05:44 +0100 |
---|---|---|
committer | soruh <[email protected]> | 2023-02-12 18:55:15 +0100 |
commit | 9e3d7ea44c2813ffaddb0accd768407ad1664a55 (patch) | |
tree | 545544ea78e768da64de50f9e846d638319d6be1 /src/config.rs | |
parent | 8cc6dac893e3a7630a6be438ac4331f0f7023dad (diff) | |
download | vaultwarden-9e3d7ea44c2813ffaddb0accd768407ad1664a55.tar.gz vaultwarden-9e3d7ea44c2813ffaddb0accd768407ad1664a55.zip |
add EXE_SUFFIX to sendmail executable when not specified
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs index e362464b..fa53c55b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,3 +1,4 @@ +use std::env::consts::EXE_SUFFIX; use std::process::exit; use std::sync::RwLock; @@ -749,12 +750,12 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> { } if cfg.use_sendmail { - let command = cfg.sendmail_command.as_deref().unwrap_or("sendmail"); + let command = cfg.sendmail_command.clone().unwrap_or_else(|| format!("sendmail{EXE_SUFFIX}")); - let mut path = std::path::PathBuf::from(command); + let mut path = std::path::PathBuf::from(&command); if !path.is_absolute() { - match which::which(command) { + match which::which(&command) { Ok(result) => path = result, Err(_) => err!(format!("sendmail command {command:?} not found in $PATH")), } |