diff options
author | Colin Gillespie <colin@cgillespie.xyz> | 2023-08-12 13:50:37 +1000 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-12 12:06:24 -0400 |
commit | 4d04fe42623a2f2b91a75cfa3d3503ab88e48acc (patch) | |
tree | 9e330a19edb76525e19bf6b8772163839e933cee | |
parent | f3976e3733e97a0e96f5fc6349d1e82b25116043 (diff) | |
download | bcachefs-tools-4d04fe42623a2f2b91a75cfa3d3503ab88e48acc.tar.gz |
cmd_mount: use the correct keyring key type
Mount is checking for and adding encryption keys using the logon key
type instead of the user key type. This was causing it to not be able to
unlock volumes on its own, and ask for a passphrase on already unlocked
volumes.
Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
-rw-r--r-- | rust-src/src/key.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rust-src/src/key.rs b/rust-src/src/key.rs index 2b4fc45e..07292e8c 100644 --- a/rust-src/src/key.rs +++ b/rust-src/src/key.rs @@ -35,7 +35,7 @@ impl std::str::FromStr for KeyLoc { fn check_for_key(key_name: &std::ffi::CStr) -> anyhow::Result<bool> { use bch_bindgen::keyutils::{self, keyctl_search}; let key_name = key_name.to_bytes_with_nul().as_ptr() as *const _; - let key_type = c_str!("logon"); + let key_type = c_str!("user"); let key_id = unsafe { keyctl_search(keyutils::KEY_SPEC_USER_KEYRING, key_type, key_name, 0) }; if key_id > 0 { @@ -101,7 +101,7 @@ fn ask_for_key(sb: &bch_sb_handle) -> anyhow::Result<()> { } else if key.magic != bch_key_magic { Err(anyhow!("failed to verify the password")) } else { - let key_type = c_str!("logon"); + let key_type = c_str!("user"); let ret = unsafe { bch_bindgen::keyutils::add_key( key_type, |