summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-04-20 08:55:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-04-20 08:55:13 +0000
commit90c23a8c17bf0420db81a7af7b711c15e8009260 (patch)
tree98ce2ccd54bd6dfc12774d2b4a57e70ffb0067d4
parentcd6b6a7ff8db41f6049540ac32b152bd9cb532ec (diff)
parent20f50df906fb8fd1db73c67a00a0826ec3c0bb13 (diff)
downloadsecurity-90c23a8c17bf0420db81a7af7b711c15e8009260.tar.gz
Merge "Fix lints from Rust 1.60.0"
-rw-r--r--keystore2/src/service.rs25
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))
}