]> git.proxmox.com Git - proxmox-backup.git/commitdiff
push: check that source namespace exists
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 21 Nov 2024 11:45:22 +0000 (12:45 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 21 Nov 2024 11:47:11 +0000 (12:47 +0100)
else, combined with remove_vanished everything on the target side would be
removed.

Suggested-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/server/push.rs

index 5c3850b58a38c3cc8ea8bf41139f52ed87c010e4..4a222627b06b8efebd82a921aada9b50d2998d76 100644 (file)
@@ -99,11 +99,16 @@ impl PushParameters {
             remote_ns.check_max_depth(max_depth)?;
         };
         let remove_vanished = remove_vanished.unwrap_or(false);
+        let store = DataStore::lookup_datastore(store, Some(Operation::Read))?;
 
-        let source = Arc::new(LocalSource {
-            store: DataStore::lookup_datastore(store, Some(Operation::Read))?,
-            ns,
-        });
+        if !store.namespace_exists(&ns) {
+            bail!(
+                "Source namespace '{ns}' doesn't exist in datastore '{store}'!",
+                store = store.name()
+            );
+        }
+
+        let source = Arc::new(LocalSource { store, ns });
 
         let (remote_config, _digest) = pbs_config::remote::config()?;
         let remote: Remote = remote_config.lookup("remote", remote_id)?;