public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] api: delay datastore lookup after permission check
@ 2024-04-25  9:49 Dietmar Maurer
  2024-04-25 10:00 ` Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dietmar Maurer @ 2024-04-25  9:49 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
 src/api2/admin/datastore.rs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index 3ea17499..3948cc0d 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -678,8 +678,6 @@ pub async fn status(
     let user_info = CachedUserInfo::new()?;
     let store_privs = user_info.lookup_privs(&auth_id, &["datastore", &store]);
 
-    let datastore = DataStore::lookup_datastore(&store, Some(Operation::Read));
-
     let store_stats = if store_privs & (PRIV_DATASTORE_AUDIT | PRIV_DATASTORE_BACKUP) != 0 {
         true
     } else if store_privs & PRIV_DATASTORE_READ != 0 {
@@ -691,7 +689,8 @@ pub async fn status(
             _ => false,
         }
     };
-    let datastore = datastore?; // only unwrap no to avoid leaking existence info
+
+    let datastore = DataStore::lookup_datastore(&store, Some(Operation::Read))?;
 
     let (counts, gc_status) = if verbose {
         let filter_owner = if store_privs & PRIV_DATASTORE_AUDIT != 0 {
-- 
2.39.2


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup] api: delay datastore lookup after permission check
  2024-04-25  9:49 [pbs-devel] [PATCH proxmox-backup] api: delay datastore lookup after permission check Dietmar Maurer
@ 2024-04-25 10:00 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-04-25 10:00 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dietmar Maurer

nit: replace "delay" with "move" to avoid that one gets confused by
questioning why a sleep, or the like, would be required here.

A short hint that this in the commit message body about this being
a clean-up to make the code easier to read, with no semantic change
intended, would be also appreciated (can also be amended when
applying this though, so no real need for a v2).


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-25 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25  9:49 [pbs-devel] [PATCH proxmox-backup] api: delay datastore lookup after permission check Dietmar Maurer
2024-04-25 10:00 ` Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal