public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] fix #3060:: improve get_owner error handling
@ 2020-11-10 11:08 Fabian Grünbichler
  2020-11-10 12:18 ` [pbs-devel] applied: " Dietmar Maurer
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2020-11-10 11:08 UTC (permalink / raw)
  To: pbs-devel

log invalid owners to system log, and continue with next group just as
if permission checks fail for the following operations:
- verify store with limited permissions
- list store groups
- list store snapshots

all other call sites either handle it correctly already (sync/pull), or
operate on a single group/snapshot and can bubble up the error.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/api2/admin/datastore.rs | 16 ++++++++++++++--
 src/backup/verify.rs        |  7 ++++++-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index b051e8dd..8256f02f 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -187,7 +187,13 @@ fn list_groups(
         let group = info.backup_dir.group();
 
         let list_all = (user_privs & PRIV_DATASTORE_AUDIT) != 0;
-        let owner = datastore.get_owner(group)?;
+        let owner = match datastore.get_owner(group) {
+            Ok(auth_id) => auth_id,
+            Err(err) => {
+                println!("Failed to get owner of group '{}' - {}", group, err);
+                continue;
+            },
+        };
         if !list_all && check_backup_owner(&owner, &auth_id).is_err() {
             continue;
         }
@@ -369,7 +375,13 @@ pub fn list_snapshots (
         }
 
         let list_all = (user_privs & PRIV_DATASTORE_AUDIT) != 0;
-        let owner = datastore.get_owner(group)?;
+        let owner = match datastore.get_owner(group) {
+            Ok(auth_id) => auth_id,
+            Err(err) => {
+                println!("Failed to get owner of group '{}' - {}", group, err);
+                continue;
+            },
+        };
 
         if !list_all && check_backup_owner(&owner, &auth_id).is_err() {
             continue;
diff --git a/src/backup/verify.rs b/src/backup/verify.rs
index e0e28ee9..b5bb85fc 100644
--- a/src/backup/verify.rs
+++ b/src/backup/verify.rs
@@ -516,7 +516,12 @@ pub fn verify_all_backups(
                             && !owner.is_token()
                             && group_owner.user() == owner.user())
                 },
-                Err(_) => false,
+                Err(err) => {
+                    // intentionally not in task log
+                    // the task user might not be allowed to see this group!
+                    println!("Failed to get owner of group '{}' - {}", group, err);
+                    false
+                },
             }
         } else {
             true
-- 
2.20.1





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

* [pbs-devel] applied: [PATCH proxmox-backup] fix #3060:: improve get_owner error handling
  2020-11-10 11:08 [pbs-devel] [PATCH proxmox-backup] fix #3060:: improve get_owner error handling Fabian Grünbichler
@ 2020-11-10 12:18 ` Dietmar Maurer
  0 siblings, 0 replies; 2+ messages in thread
From: Dietmar Maurer @ 2020-11-10 12:18 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Fabian Grünbichler

applied




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

end of thread, other threads:[~2020-11-10 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 11:08 [pbs-devel] [PATCH proxmox-backup] fix #3060:: improve get_owner error handling Fabian Grünbichler
2020-11-10 12:18 ` [pbs-devel] applied: " Dietmar Maurer

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