diff options
author | Chris Wailes <chriswailes@google.com> | 2022-04-19 17:23:52 -0700 |
---|---|---|
committer | Chris Wailes <chriswailes@google.com> | 2022-04-19 17:23:52 -0700 |
commit | 20f50df906fb8fd1db73c67a00a0826ec3c0bb13 (patch) | |
tree | 61401e2899a58c0dcb03654bd79dd31e1b334b2f | |
parent | 4e005bddd1120c5c5fd867450eeeefad232a6776 (diff) | |
download | security-20f50df906fb8fd1db73c67a00a0826ec3c0bb13.tar.gz |
Fix lints from Rust 1.60.0
Bug: 222737227
Test: m rust
Change-Id: I4f35c8e50a1837608ab69a7609caff9c485e8c85
-rw-r--r-- | keystore2/src/service.rs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/keystore2/src/service.rs b/keystore2/src/service.rs index 79e76923..d634e0c0 100644 --- a/keystore2/src/service.rs +++ b/keystore2/src/service.rs @@ -276,22 +276,19 @@ impl KeystoreService { // If the first check fails we check if the caller has the list permission allowing to list // any namespace. In that case we also adjust the queried namespace if a specific uid was // selected. - match check_key_permission(KeyPerm::GetInfo, &k, &None) { - Err(e) => { - if let Some(selinux::Error::PermissionDenied) = - e.root_cause().downcast_ref::<selinux::Error>() - { - check_keystore_permission(KeystorePerm::List) - .context("In list_entries: While checking keystore permission.")?; - if namespace != -1 { - k.nspace = namespace; - } - } else { - return Err(e).context("In list_entries: While checking key permission.")?; + if let Err(e) = check_key_permission(KeyPerm::GetInfo, &k, &None) { + if let Some(selinux::Error::PermissionDenied) = + e.root_cause().downcast_ref::<selinux::Error>() { + + check_keystore_permission(KeystorePerm::List) + .context("In list_entries: While checking keystore permission.")?; + if namespace != -1 { + k.nspace = namespace; } + } else { + return Err(e).context("In list_entries: While checking key permission.")?; } - Ok(()) => {} - }; + } DB.with(|db| list_key_entries(&mut db.borrow_mut(), k.domain, k.nspace)) } |