mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-09 00:00:04 +03:00
fix(key): remove any newlines from passphrase
To match the behavior of the C code and because there may be newlines under some conditions. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
This commit is contained in:
parent
87ab1fd7ed
commit
e4271d7a3e
@ -158,7 +158,7 @@ impl Passphrase {
|
||||
line
|
||||
};
|
||||
|
||||
Ok(Self(CString::new(passphrase.as_str())?))
|
||||
Ok(Self(CString::new(passphrase.trim_end_matches('\n'))?))
|
||||
}
|
||||
|
||||
pub fn new_from_file(sb: &bch_sb_handle, passphrase_file: impl AsRef<Path>) -> Result<Self> {
|
||||
@ -172,6 +172,6 @@ impl Passphrase {
|
||||
|
||||
let passphrase = Zeroizing::new(fs::read_to_string(passphrase_file)?);
|
||||
|
||||
Ok(Self(CString::new(passphrase.as_str())?))
|
||||
Ok(Self(CString::new(passphrase.trim_end_matches('\n'))?))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user