From 1defba0da8cb52b7da568eea6d15bf4f986c1220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Thu, 1 Feb 2024 11:42:37 +0100 Subject: [PATCH] fetch_all_keys: Do not filter by kind fetch_all_keys fills a cache. This cache is expected to contain all objects, not just the kind that was first fetched. --- pkcs11/src/backend/session.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkcs11/src/backend/session.rs b/pkcs11/src/backend/session.rs index f46ac231..e1737f3f 100644 --- a/pkcs11/src/backend/session.rs +++ b/pkcs11/src/backend/session.rs @@ -475,7 +475,7 @@ impl Session { Ok(results) } - None => self.fetch_all_keys(requirements.kind), + None => self.fetch_all_keys(), }?; if let Some(kind) = requirements.kind { @@ -485,10 +485,7 @@ impl Session { Ok(result.iter().map(|(handle, _)| *handle).collect()) } - fn fetch_all_keys( - &mut self, - kind: Option, - ) -> Result, Error> { + fn fetch_all_keys(&mut self) -> Result, Error> { { let db = self.db.lock()?; @@ -520,11 +517,11 @@ impl Session { let results: Result, _> = if THREADS_ALLOWED.load(Ordering::Relaxed) { use rayon::prelude::*; keys.par_iter() - .map(|k| super::key::fetch_one(k, &self.db, &self.login_ctx, kind)) + .map(|k| super::key::fetch_one(k, &self.db, &self.login_ctx, None)) .collect() } else { keys.iter() - .map(|k| super::key::fetch_one(k, &self.db, &self.login_ctx, kind)) + .map(|k| super::key::fetch_one(k, &self.db, &self.login_ctx, None)) .collect() };