aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Gillespie <colin@cgillespie.xyz>2023-09-08 17:27:52 +1000
committerKent Overstreet <kent.overstreet@linux.dev>2023-09-08 04:05:39 -0400
commit9fe08ba354453dddc527313f6787ddaaf5361a5e (patch)
treed5c2b57d99890c9f58aa2a32b2eadff6271ca287
parent8d5e53b88aaafe7c01fc369e52dbd1fc8955a77d (diff)
downloadbcachefs-tools-9fe08ba354453dddc527313f6787ddaaf5361a5e.tar.gz
cmd_mount: request passphrase if the existing key is revoked
Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
-rw-r--r--rust-src/src/key.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/rust-src/src/key.rs b/rust-src/src/key.rs
index 07292e8c..9319351e 100644
--- a/rust-src/src/key.rs
+++ b/rust-src/src/key.rs
@@ -41,10 +41,11 @@ fn check_for_key(key_name: &std::ffi::CStr) -> anyhow::Result<bool> {
if key_id > 0 {
info!("Key has became available");
Ok(true)
- } else if errno::errno().0 != libc::ENOKEY {
- Err(crate::ErrnoError(errno::errno()).into())
} else {
- Ok(false)
+ match errno::errno().0 {
+ libc::ENOKEY | libc::EKEYREVOKED => Ok(false),
+ _ => Err(crate::ErrnoError(errno::errno()).into()),
+ }
}
}