cmd_mount: request passphrase if the existing key is revoked

Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
This commit is contained in:
Colin Gillespie 2023-09-08 17:27:52 +10:00 committed by Kent Overstreet
parent 8d5e53b88a
commit 9fe08ba354

View File

@ -41,10 +41,11 @@ fn check_for_key(key_name: &std::ffi::CStr) -> anyhow::Result<bool> {
if key_id > 0 { if key_id > 0 {
info!("Key has became available"); info!("Key has became available");
Ok(true) Ok(true)
} else if errno::errno().0 != libc::ENOKEY {
Err(crate::ErrnoError(errno::errno()).into())
} else { } else {
Ok(false) match errno::errno().0 {
libc::ENOKEY | libc::EKEYREVOKED => Ok(false),
_ => Err(crate::ErrnoError(errno::errno()).into()),
}
} }
} }