[fix] webnsupdate: trim newlines from pass file
This commit is contained in:
parent
2c7f9fc632
commit
68658bf83f
1 changed files with 3 additions and 2 deletions
|
@ -145,8 +145,9 @@ async fn main() -> Result<()> {
|
||||||
password_hash: None,
|
password_hash: None,
|
||||||
};
|
};
|
||||||
if let Some(password_file) = password_file {
|
if let Some(password_file) = password_file {
|
||||||
let pass = std::fs::read(password_file).into_diagnostic()?;
|
let pass = std::fs::read_to_string(password_file).into_diagnostic()?;
|
||||||
state.password_hash = Some(pass.leak());
|
let pass: Box<[u8]> = pass.trim().as_bytes().into();
|
||||||
|
state.password_hash = Some(Box::leak(pass));
|
||||||
} else {
|
} else {
|
||||||
ensure!(insecure, "a password must be used");
|
ensure!(insecure, "a password must be used");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue