[fix] webnsupdate: trim newlines from pass file

This commit is contained in:
Jalil David Salamé Messina 2024-05-09 00:24:19 +02:00
parent 2c7f9fc632
commit 68658bf83f
Signed by: jalil
GPG key ID: F016B9E770737A0B

View file

@ -145,8 +145,9 @@ async fn main() -> Result<()> {
password_hash: None,
};
if let Some(password_file) = password_file {
let pass = std::fs::read(password_file).into_diagnostic()?;
state.password_hash = Some(pass.leak());
let pass = std::fs::read_to_string(password_file).into_diagnostic()?;
let pass: Box<[u8]> = pass.trim().as_bytes().into();
state.password_hash = Some(Box::leak(pass));
} else {
ensure!(insecure, "a password must be used");
}