From 4d04fe42623a2f2b91a75cfa3d3503ab88e48acc Mon Sep 17 00:00:00 2001 From: Colin Gillespie Date: Sat, 12 Aug 2023 13:50:37 +1000 Subject: 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 --- rust-src/src/key.rs | 4 ++-- 1 file 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 { 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, -- cgit v1.2.3