* [PATCH proxmox-backup] cli: fix move-namespace and move-group running as root
@ 2026-04-24 11:20 Hannes Laimer
2026-04-24 16:49 ` applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Laimer @ 2026-04-24 11:20 UTC (permalink / raw)
To: pbs-devel
The 'move-namespace' and 'move-group' commands of called their api
handler in-process via the CLI's rpcenv, so the worker task ran inside
the manager process and wrote into the datastore as root. Route them
through the api with connect_to_localhost() instead.
Reported-by: Michael Köppl <m.koeppl@proxmox.com>
Fixes: 4d74e20d ("cli: add move-namespace and move-group commands")
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
src/bin/proxmox_backup_manager/datastore.rs | 43 +++++++++++----------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/bin/proxmox_backup_manager/datastore.rs b/src/bin/proxmox_backup_manager/datastore.rs
index 0ad97fda..738d0fa5 100644
--- a/src/bin/proxmox_backup_manager/datastore.rs
+++ b/src/bin/proxmox_backup_manager/datastore.rs
@@ -325,7 +325,6 @@ async fn uuid_mount(mut param: Value, _rpcenv: &mut dyn RpcEnvironment) -> Resul
}
#[api(
- protected: true,
input: {
properties: {
store: {
@@ -356,28 +355,27 @@ async fn uuid_mount(mut param: Value, _rpcenv: &mut dyn RpcEnvironment) -> Resul
namespace, merge snapshots into it. Requires matching ownership and \
non-overlapping snapshot times.",
},
+ "output-format": {
+ schema: OUTPUT_FORMAT,
+ optional: true,
+ },
},
},
)]
/// Move a backup namespace to a new location within the same datastore.
-async fn cli_move_namespace(
- mut param: Value,
- rpcenv: &mut dyn RpcEnvironment,
-) -> Result<(), Error> {
- param["node"] = "localhost".into();
+async fn cli_move_namespace(store: String, mut param: Value) -> Result<(), Error> {
+ let output_format = extract_output_format(&mut param);
- let info = &api2::admin::namespace::API_METHOD_MOVE_NAMESPACE;
- let result = match info.handler {
- ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
- _ => unreachable!(),
- };
+ let client = connect_to_localhost()?;
+ let path = format!("api2/json/admin/datastore/{store}/move-namespace");
+ let result = client.post(&path, Some(param)).await?;
+
+ view_task_result(&client, result, &output_format).await?;
- crate::wait_for_local_worker(result.as_str().unwrap()).await?;
Ok(())
}
#[api(
- protected: true,
input: {
properties: {
store: {
@@ -401,20 +399,23 @@ async fn cli_move_namespace(
snapshots into it. Requires matching ownership and non-overlapping \
snapshot times.",
},
+ "output-format": {
+ schema: OUTPUT_FORMAT,
+ optional: true,
+ },
},
},
)]
/// Move a backup group to a different namespace within the same datastore.
-async fn cli_move_group(mut param: Value, rpcenv: &mut dyn RpcEnvironment) -> Result<(), Error> {
- param["node"] = "localhost".into();
+async fn cli_move_group(store: String, mut param: Value) -> Result<(), Error> {
+ let output_format = extract_output_format(&mut param);
- let info = &api2::admin::datastore::API_METHOD_MOVE_GROUP;
- let result = match info.handler {
- ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
- _ => unreachable!(),
- };
+ let client = connect_to_localhost()?;
+ let path = format!("api2/json/admin/datastore/{store}/move-group");
+ let result = client.post(&path, Some(param)).await?;
+
+ view_task_result(&client, result, &output_format).await?;
- crate::wait_for_local_worker(result.as_str().unwrap()).await?;
Ok(())
}
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-24 16:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-24 11:20 [PATCH proxmox-backup] cli: fix move-namespace and move-group running as root Hannes Laimer
2026-04-24 16:49 ` applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox