From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 86C416C8B6 for ; Thu, 23 Sep 2021 15:21:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 845F6266FC for ; Thu, 23 Sep 2021 15:21:10 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 1939A266F0 for ; Thu, 23 Sep 2021 15:21:07 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id C345344A83 for ; Thu, 23 Sep 2021 15:21:06 +0200 (CEST) Date: Thu, 23 Sep 2021 15:20:58 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20210923101329.950146-1-dietmar@proxmox.com> In-Reply-To: <20210923101329.950146-1-dietmar@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1632402995.bpvxdspgad.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.352 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/6] src/server/worker_task.rs: Avoid using pbs-api-type::Authid X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2021 13:21:10 -0000 On September 23, 2021 12:13 pm, Dietmar Maurer wrote: > Because we want to move worker_task.rs into proxmox-rest-server crate. as discussed off-list, we could use a=20 struct AuthidStr(String) or a trait defined in proxmox instead of a regular String, to avoid=20 accidentally passing in other, non authid strings. all Authid=20 implementations would then need to implement Into (/the=20 trait), and the calls below to to_string() would become into() (remain=20 as they were). can also be done as follow-up with a proxmox bump if we want to discuss=20 it more in-depth but still go ahead with the split/move now. > --- > pbs-api-types/src/upid.rs | 13 +++++++------ > src/api2/admin/datastore.rs | 6 +++--- > src/api2/backup/environment.rs | 2 +- > src/api2/backup/mod.rs | 2 +- > src/api2/config/acme.rs | 6 +++--- > src/api2/config/datastore.rs | 4 ++-- > src/api2/node/apt.rs | 4 ++-- > src/api2/node/certificates.rs | 6 +++--- > src/api2/node/disks/directory.rs | 4 ++-- > src/api2/node/disks/mod.rs | 4 ++-- > src/api2/node/disks/zfs.rs | 4 ++-- > src/api2/node/mod.rs | 2 +- > src/api2/node/network.rs | 2 +- > src/api2/node/services.rs | 2 +- > src/api2/node/tasks.rs | 15 +++++++++------ > src/api2/pull.rs | 4 ++-- > src/api2/reader/mod.rs | 2 +- > src/api2/tape/backup.rs | 4 ++-- > src/api2/tape/drive.rs | 2 +- > src/api2/tape/restore.rs | 2 +- > src/bin/proxmox-backup-proxy.rs | 2 +- > src/server/gc_job.rs | 2 +- > src/server/prune_job.rs | 2 +- > src/server/verify_job.rs | 2 +- > src/server/worker_task.rs | 8 ++++---- > 25 files changed, 55 insertions(+), 51 deletions(-) >=20 > diff --git a/pbs-api-types/src/upid.rs b/pbs-api-types/src/upid.rs > index ba23a646..29135bca 100644 > --- a/pbs-api-types/src/upid.rs > +++ b/pbs-api-types/src/upid.rs > @@ -8,8 +8,6 @@ use proxmox::api::schema::{ApiStringFormat, ApiType, Sche= ma, StringSchema, Array > use proxmox::const_regex; > use proxmox::sys::linux::procfs; > =20 > -use crate::Authid; > - > /// Unique Process/Task Identifier > /// > /// We use this to uniquely identify worker task. UPIDs have a short > @@ -37,7 +35,7 @@ pub struct UPID { > /// Worker ID (arbitrary ASCII string) > pub worker_id: Option, > /// The authenticated entity who started the task > - pub auth_id: Authid, > + pub auth_id: String, > /// The node name. > pub node: String, > } > @@ -71,7 +69,7 @@ impl UPID { > pub fn new( > worker_type: &str, > worker_id: Option, > - auth_id: Authid, > + auth_id: String, > ) -> Result { > =20 > let pid =3D unsafe { libc::getpid() }; > @@ -82,6 +80,10 @@ impl UPID { > bail!("illegal characters in worker type '{}'", worker_type)= ; > } > =20 > + if auth_id.contains(bad) { > + bail!("illegal characters in auth_id '{}'", auth_id); > + } > + > static WORKER_TASK_NEXT_ID: AtomicUsize =3D AtomicUsize::new(0); > =20 > let task_id =3D WORKER_TASK_NEXT_ID.fetch_add(1, Ordering::SeqCs= t); > @@ -184,7 +186,7 @@ pub struct TaskListItem { > /// Worker ID (arbitrary ASCII string) > pub worker_id: Option, > /// The authenticated entity who started the task > - pub user: Authid, > + pub user: String, > /// The task end time (Epoch) > #[serde(skip_serializing_if=3D"Option::is_none")] > pub endtime: Option, > @@ -200,4 +202,3 @@ pub const NODE_TASKS_LIST_TASKS_RETURN_TYPE: ReturnTy= pe =3D ReturnType { > &TaskListItem::API_SCHEMA, > ).schema(), > }; > - > diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs > index 0b14dfbf..fbb93f35 100644 > --- a/src/api2/admin/datastore.rs > +++ b/src/api2/admin/datastore.rs > @@ -722,7 +722,7 @@ pub fn verify( > let upid_str =3D WorkerTask::new_thread( > worker_type, > Some(worker_id), > - auth_id.clone(), > + auth_id.to_string(), > to_stdout, > move |worker| { > let verify_worker =3D crate::backup::VerifyWorker::new(worke= r.clone(), datastore); > @@ -862,7 +862,7 @@ pub fn prune( > =20 > =20 > // We use a WorkerTask just to have a task log, but run synchrounous= ly > - let worker =3D WorkerTask::new("prune", Some(worker_id), auth_id, tr= ue)?; > + let worker =3D WorkerTask::new("prune", Some(worker_id), auth_id.to_= string(), true)?; > =20 > if keep_all { > worker.log("No prune selection - keeping all files."); > @@ -957,7 +957,7 @@ pub fn prune_datastore( > let upid_str =3D WorkerTask::new_thread( > "prune", > Some(store.clone()), > - auth_id.clone(), > + auth_id.to_string(), > to_stdout, > move |worker| crate::server::prune_datastore( > worker.clone(), > diff --git a/src/api2/backup/environment.rs b/src/api2/backup/environment= .rs > index 129ebd2b..306f91ee 100644 > --- a/src/api2/backup/environment.rs > +++ b/src/api2/backup/environment.rs > @@ -525,7 +525,7 @@ impl BackupEnvironment { > WorkerTask::new_thread( > "verify", > Some(worker_id), > - self.auth_id.clone(), > + self.auth_id.to_string(), > false, > move |worker| { > worker.log("Automatically verifying newly added snapshot= "); > diff --git a/src/api2/backup/mod.rs b/src/api2/backup/mod.rs > index 8f51f314..c14f19a4 100644 > --- a/src/api2/backup/mod.rs > +++ b/src/api2/backup/mod.rs > @@ -166,7 +166,7 @@ async move { > if !is_new { bail!("backup directory already exists."); } > =20 > =20 > - WorkerTask::spawn(worker_type, Some(worker_id), auth_id.clone(), tru= e, move |worker| { > + WorkerTask::spawn(worker_type, Some(worker_id), auth_id.to_string(),= true, move |worker| { > let mut env =3D BackupEnvironment::new( > env_type, auth_id, worker.clone(), datastore, backup_dir); > =20 > diff --git a/src/api2/config/acme.rs b/src/api2/config/acme.rs > index 593b79a3..564cafae 100644 > --- a/src/api2/config/acme.rs > +++ b/src/api2/config/acme.rs > @@ -215,7 +215,7 @@ fn register_account( > WorkerTask::spawn( > "acme-register", > Some(name.to_string()), > - auth_id, > + auth_id.to_string(), > true, > move |worker| async move { > let mut client =3D AcmeClient::new(directory); > @@ -275,7 +275,7 @@ pub fn update_account( > WorkerTask::spawn( > "acme-update", > Some(name.to_string()), > - auth_id, > + auth_id.to_string(), > true, > move |_worker| async move { > let data =3D match contact { > @@ -320,7 +320,7 @@ pub fn deactivate_account( > WorkerTask::spawn( > "acme-deactivate", > Some(name.to_string()), > - auth_id, > + auth_id.to_string(), > true, > move |worker| async move { > match AcmeClient::load(&name) > diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs > index c6036fc3..0e6529f8 100644 > --- a/src/api2/config/datastore.rs > +++ b/src/api2/config/datastore.rs > @@ -119,9 +119,9 @@ pub fn create_datastore( > WorkerTask::new_thread( > "create-datastore", > Some(config.name.to_string()), > - auth_id, > + auth_id.to_string(), > to_stdout, > - move |worker| do_create_datastore(lock, section_config, config, = Some(&worker)), > + move |worker| do_create_datastore(lock, section_config, config, S= ome(&worker)), > ) > } > =20 > diff --git a/src/api2/node/apt.rs b/src/api2/node/apt.rs > index 8f4bc691..f02920c0 100644 > --- a/src/api2/node/apt.rs > +++ b/src/api2/node/apt.rs > @@ -14,7 +14,7 @@ use proxmox_apt::repositories::{ > use proxmox_http::ProxyConfig; > =20 > use pbs_api_types::{ > - Authid, APTUpdateInfo, NODE_SCHEMA, PROXMOX_CONFIG_DIGEST_SCHEMA, UP= ID_SCHEMA, > + APTUpdateInfo, NODE_SCHEMA, PROXMOX_CONFIG_DIGEST_SCHEMA, UPID_SCHEM= A, > PRIV_SYS_AUDIT, PRIV_SYS_MODIFY, > }; > =20 > @@ -154,7 +154,7 @@ pub fn apt_update_database( > rpcenv: &mut dyn RpcEnvironment, > ) -> Result { > =20 > - let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > + let auth_id =3D rpcenv.get_auth_id().unwrap(); > let to_stdout =3D rpcenv.env_type() =3D=3D RpcEnvironmentType::CLI; > =20 > let upid_str =3D WorkerTask::new_thread("aptupdate", None, auth_id, = to_stdout, move |worker| { > diff --git a/src/api2/node/certificates.rs b/src/api2/node/certificates.r= s > index 82fa028d..7b31861e 100644 > --- a/src/api2/node/certificates.rs > +++ b/src/api2/node/certificates.rs > @@ -11,7 +11,7 @@ use proxmox::api::router::SubdirMap; > use proxmox::api::{api, Permission, Router, RpcEnvironment}; > use proxmox::list_subdirs_api_method; > =20 > -use pbs_api_types::{Authid, NODE_SCHEMA, PRIV_SYS_MODIFY}; > +use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_MODIFY}; > use pbs_buildcfg::configdir; > use pbs_tools::cert; > =20 > @@ -530,7 +530,7 @@ fn spawn_certificate_worker( > =20 > let (node_config, _digest) =3D crate::config::node::config()?; > =20 > - let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > + let auth_id =3D rpcenv.get_auth_id().unwrap(); > =20 > WorkerTask::spawn(name, None, auth_id, true, move |worker| async mov= e { > if let Some(cert) =3D order_certificate(worker, &node_config).aw= ait? { > @@ -559,7 +559,7 @@ pub fn revoke_acme_cert(rpcenv: &mut dyn RpcEnvironme= nt) -> Result =20 > let cert_pem =3D get_certificate_pem()?; > =20 > - let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > + let auth_id =3D rpcenv.get_auth_id().unwrap(); > =20 > WorkerTask::spawn( > "acme-revoke-cert", > diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/direc= tory.rs > index 38809dcf..2f4a738d 100644 > --- a/src/api2/node/disks/directory.rs > +++ b/src/api2/node/disks/directory.rs > @@ -7,7 +7,7 @@ use proxmox::api::section_config::SectionConfigData; > use proxmox::api::router::Router; > =20 > use pbs_api_types::{ > - Authid, DataStoreConfig, NODE_SCHEMA, BLOCKDEVICE_NAME_SCHEMA, > + DataStoreConfig, NODE_SCHEMA, BLOCKDEVICE_NAME_SCHEMA, > DATASTORE_SCHEMA, UPID_SCHEMA, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY, > }; > =20 > @@ -146,7 +146,7 @@ pub fn create_datastore_disk( > =20 > let to_stdout =3D rpcenv.env_type() =3D=3D RpcEnvironmentType::CLI; > =20 > - let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > + let auth_id =3D rpcenv.get_auth_id().unwrap(); > =20 > let info =3D get_disk_usage_info(&disk, true)?; > =20 > diff --git a/src/api2/node/disks/mod.rs b/src/api2/node/disks/mod.rs > index 67f8f63a..b4001a54 100644 > --- a/src/api2/node/disks/mod.rs > +++ b/src/api2/node/disks/mod.rs > @@ -7,7 +7,7 @@ use proxmox::{sortable, identity}; > use proxmox::{list_subdirs_api_method}; > =20 > use pbs_api_types::{ > - Authid, UPID_SCHEMA, NODE_SCHEMA, BLOCKDEVICE_NAME_SCHEMA, > + UPID_SCHEMA, NODE_SCHEMA, BLOCKDEVICE_NAME_SCHEMA, > PRIV_SYS_AUDIT, PRIV_SYS_MODIFY, > }; > =20 > @@ -144,7 +144,7 @@ pub fn initialize_disk( > =20 > let to_stdout =3D rpcenv.env_type() =3D=3D RpcEnvironmentType::CLI; > =20 > - let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > + let auth_id =3D rpcenv.get_auth_id().unwrap(); > =20 > let info =3D get_disk_usage_info(&disk, true)?; > =20 > diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs > index 14c2cfec..9fe0dac4 100644 > --- a/src/api2/node/disks/zfs.rs > +++ b/src/api2/node/disks/zfs.rs > @@ -8,7 +8,7 @@ use proxmox::api::{ > use proxmox::api::router::Router; > =20 > use pbs_api_types::{ > - Authid, ZpoolListItem, ZfsRaidLevel, ZfsCompressionType, DataStoreCo= nfig, > + ZpoolListItem, ZfsRaidLevel, ZfsCompressionType, DataStoreConfig, > NODE_SCHEMA, ZPOOL_NAME_SCHEMA, DATASTORE_SCHEMA, DISK_ARRAY_SCHEMA, > DISK_LIST_SCHEMA, ZFS_ASHIFT_SCHEMA, UPID_SCHEMA, > PRIV_SYS_AUDIT, PRIV_SYS_MODIFY, > @@ -168,7 +168,7 @@ pub fn create_zpool( > =20 > let to_stdout =3D rpcenv.env_type() =3D=3D RpcEnvironmentType::CLI; > =20 > - let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > + let auth_id =3D rpcenv.get_auth_id().unwrap(); > =20 > let add_datastore =3D add_datastore.unwrap_or(false); > =20 > diff --git a/src/api2/node/mod.rs b/src/api2/node/mod.rs > index 9b31d595..8e357311 100644 > --- a/src/api2/node/mod.rs > +++ b/src/api2/node/mod.rs > @@ -146,7 +146,7 @@ async fn termproxy(cmd: Option, rpcenv: &mut = dyn RpcEnvironment) -> Resu > let upid =3D WorkerTask::spawn( > "termproxy", > None, > - auth_id, > + auth_id.to_string(), > false, > move |worker| async move { > // move inside the worker so that it survives and does not c= lose the port > diff --git a/src/api2/node/network.rs b/src/api2/node/network.rs > index 351fd11c..0fde9f2a 100644 > --- a/src/api2/node/network.rs > +++ b/src/api2/node/network.rs > @@ -703,7 +703,7 @@ pub async fn reload_network_config( > =20 > let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > =20 > - let upid_str =3D WorkerTask::spawn("srvreload", Some(String::from("n= etworking")), auth_id, true, |_worker| async { > + let upid_str =3D WorkerTask::spawn("srvreload", Some(String::from("n= etworking")), auth_id.to_string(), true, |_worker| async { > =20 > let _ =3D std::fs::rename(network::NETWORK_INTERFACES_NEW_FILENA= ME, network::NETWORK_INTERFACES_FILENAME); > =20 > diff --git a/src/api2/node/services.rs b/src/api2/node/services.rs > index 25edd1b6..6c757f43 100644 > --- a/src/api2/node/services.rs > +++ b/src/api2/node/services.rs > @@ -195,7 +195,7 @@ fn run_service_command(service: &str, cmd: &str, auth= _id: Authid) -> Result let upid =3D WorkerTask::new_thread( > &workerid, > Some(service.clone()), > - auth_id, > + auth_id.to_string(), > false, > move |_worker| { > =20 > diff --git a/src/api2/node/tasks.rs b/src/api2/node/tasks.rs > index 7066f889..169a3d4d 100644 > --- a/src/api2/node/tasks.rs > +++ b/src/api2/node/tasks.rs > @@ -99,8 +99,8 @@ fn check_job_store(upid: &UPID, store: &str) -> bool { > } > =20 > fn check_task_access(auth_id: &Authid, upid: &UPID) -> Result<(), Error>= { > - let task_auth_id =3D &upid.auth_id; > - if auth_id =3D=3D task_auth_id > + let task_auth_id: Authid =3D upid.auth_id.parse()?; > + if auth_id =3D=3D &task_auth_id > || (task_auth_id.is_token() && &Authid::from(task_auth_id.user()= .clone()) =3D=3D auth_id) { > // task owner can always read > Ok(()) > @@ -200,6 +200,8 @@ async fn get_task_status( > let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > check_task_access(&auth_id, &upid)?; > =20 > + let task_auth_id: Authid =3D upid.auth_id.parse()?; > + > let mut result =3D json!({ > "upid": param["upid"], > "node": upid.node, > @@ -208,11 +210,11 @@ async fn get_task_status( > "starttime": upid.starttime, > "type": upid.worker_type, > "id": upid.worker_id, > - "user": upid.auth_id.user(), > + "user": task_auth_id.user(), > }); > =20 > - if upid.auth_id.is_token() { > - result["tokenid"] =3D Value::from(upid.auth_id.tokenname().unwra= p().as_str()); > + if task_auth_id.is_token() { > + result["tokenid"] =3D Value::from(task_auth_id.tokenname().unwra= p().as_str()); > } > =20 > if crate::server::worker_is_active(&upid).await? { > @@ -344,10 +346,11 @@ fn stop_task( > =20 > let upid =3D extract_upid(¶m)?; > =20 > - let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > + let auth_id =3D rpcenv.get_auth_id().unwrap(); > =20 > if auth_id !=3D upid.auth_id { > let user_info =3D CachedUserInfo::new()?; > + let auth_id: Authid =3D auth_id.parse()?; > user_info.check_privs(&auth_id, &["system", "tasks"], PRIV_SYS_M= ODIFY, false)?; > } > =20 > diff --git a/src/api2/pull.rs b/src/api2/pull.rs > index 1eb86ea3..e631920f 100644 > --- a/src/api2/pull.rs > +++ b/src/api2/pull.rs > @@ -81,7 +81,7 @@ pub fn do_sync_job( > let upid_str =3D WorkerTask::spawn( > &worker_type, > Some(job_id.clone()), > - auth_id.clone(), > + auth_id.to_string(), > to_stdout, > move |worker| async move { > =20 > @@ -183,7 +183,7 @@ async fn pull ( > let (client, src_repo, tgt_store) =3D get_pull_parameters(&store, &r= emote, &remote_store).await?; > =20 > // fixme: set to_stdout to false? > - let upid_str =3D WorkerTask::spawn("sync", Some(store.clone()), auth= _id.clone(), true, move |worker| async move { > + let upid_str =3D WorkerTask::spawn("sync", Some(store.clone()), auth= _id.to_string(), true, move |worker| async move { > =20 > worker.log(format!("sync datastore '{}' start", store)); > =20 > diff --git a/src/api2/reader/mod.rs b/src/api2/reader/mod.rs > index 821e83c4..fada952c 100644 > --- a/src/api2/reader/mod.rs > +++ b/src/api2/reader/mod.rs > @@ -143,7 +143,7 @@ fn upgrade_to_backup_reader_protocol( > =20 > let worker_id =3D format!("{}:{}/{}/{:08X}", store, backup_type,= backup_id, backup_dir.backup_time()); > =20 > - WorkerTask::spawn("reader", Some(worker_id), auth_id.clone(), tr= ue, move |worker| async move { > + WorkerTask::spawn("reader", Some(worker_id), auth_id.to_string()= , true, move |worker| async move { > let _guard =3D _guard; > =20 > let mut env =3D ReaderEnvironment::new( > diff --git a/src/api2/tape/backup.rs b/src/api2/tape/backup.rs > index 6b533820..fadbfa3d 100644 > --- a/src/api2/tape/backup.rs > +++ b/src/api2/tape/backup.rs > @@ -195,7 +195,7 @@ pub fn do_tape_backup_job( > let upid_str =3D WorkerTask::new_thread( > &worker_type, > Some(job_id.clone()), > - auth_id.clone(), > + auth_id.to_string(), > to_stdout, > move |worker| { > job.start(&worker.upid().to_string())?; > @@ -376,7 +376,7 @@ pub fn backup( > let upid_str =3D WorkerTask::new_thread( > "tape-backup", > Some(job_id), > - auth_id, > + auth_id.to_string(), > to_stdout, > move |worker| { > let _drive_lock =3D drive_lock; // keep lock guard > diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs > index 58f49f43..10aa6842 100644 > --- a/src/api2/tape/drive.rs > +++ b/src/api2/tape/drive.rs > @@ -87,7 +87,7 @@ where > let (config, _digest) =3D pbs_config::drive::config()?; > let lock_guard =3D lock_tape_device(&config, &drive)?; > =20 > - let auth_id: Authid =3D rpcenv.get_auth_id().unwrap().parse()?; > + let auth_id =3D rpcenv.get_auth_id().unwrap(); > let to_stdout =3D rpcenv.env_type() =3D=3D RpcEnvironmentType::CLI; > =20 > WorkerTask::new_thread(worker_type, job_id, auth_id, to_stdout, move= |worker| { > diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs > index 4ab60e8f..7739d1a4 100644 > --- a/src/api2/tape/restore.rs > +++ b/src/api2/tape/restore.rs > @@ -275,7 +275,7 @@ pub fn restore( > let upid_str =3D WorkerTask::new_thread( > "tape-restore", > Some(taskid), > - auth_id.clone(), > + auth_id.to_string(), > to_stdout, > move |worker| { > let _drive_lock =3D drive_lock; // keep lock guard > diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-pro= xy.rs > index 6734525b..518054bf 100644 > --- a/src/bin/proxmox-backup-proxy.rs > +++ b/src/bin/proxmox-backup-proxy.rs > @@ -745,7 +745,7 @@ async fn schedule_task_log_rotate() { > if let Err(err) =3D WorkerTask::new_thread( > worker_type, > None, > - Authid::root_auth_id().clone(), > + Authid::root_auth_id().to_string(), > false, > move |worker| { > job.start(&worker.upid().to_string())?; > diff --git a/src/server/gc_job.rs b/src/server/gc_job.rs > index 665b9631..317f4a36 100644 > --- a/src/server/gc_job.rs > +++ b/src/server/gc_job.rs > @@ -26,7 +26,7 @@ pub fn do_garbage_collection_job( > let upid_str =3D WorkerTask::new_thread( > &worker_type, > Some(store.clone()), > - auth_id.clone(), > + auth_id.to_string(), > to_stdout, > move |worker| { > job.start(&worker.upid().to_string())?; > diff --git a/src/server/prune_job.rs b/src/server/prune_job.rs > index f298a74c..8d971a1c 100644 > --- a/src/server/prune_job.rs > +++ b/src/server/prune_job.rs > @@ -105,7 +105,7 @@ pub fn do_prune_job( > let upid_str =3D WorkerTask::new_thread( > &worker_type, > Some(job.jobname().to_string()), > - auth_id.clone(), > + auth_id.to_string(), > false, > move |worker| { > job.start(&worker.upid().to_string())?; > diff --git a/src/server/verify_job.rs b/src/server/verify_job.rs > index 7f6d73ff..6005b706 100644 > --- a/src/server/verify_job.rs > +++ b/src/server/verify_job.rs > @@ -36,7 +36,7 @@ pub fn do_verification_job( > let upid_str =3D WorkerTask::new_thread( > &worker_type, > Some(job_id.clone()), > - auth_id.clone(), > + auth_id.to_string(), > to_stdout, > move |worker| { > job.start(&worker.upid().to_string())?; > diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs > index a74b18e1..92ab50d7 100644 > --- a/src/server/worker_task.rs > +++ b/src/server/worker_task.rs > @@ -18,7 +18,7 @@ use proxmox::tools::fs::{create_path, replace_file, Cre= ateOptions}; > =20 > use pbs_buildcfg; > use pbs_tools::logrotate::{LogRotate, LogRotateFiles}; > -use pbs_api_types::{Authid, UPID}; > +use pbs_api_types::UPID; > use pbs_config::{open_backup_lockfile, BackupLockGuard}; > use proxmox_rest_server::{CommandoSocket, FileLogger, FileLogOptions}; > =20 > @@ -589,7 +589,7 @@ struct WorkerTaskData { > =20 > impl WorkerTask { > =20 > - pub fn new(worker_type: &str, worker_id: Option, auth_id: Au= thid, to_stdout: bool) -> Result, Error> { > + pub fn new(worker_type: &str, worker_id: Option, auth_id: St= ring, to_stdout: bool) -> Result, Error> { > let upid =3D UPID::new(worker_type, worker_id, auth_id)?; > let task_id =3D upid.task_id; > =20 > @@ -640,7 +640,7 @@ impl WorkerTask { > pub fn spawn( > worker_type: &str, > worker_id: Option, > - auth_id: Authid, > + auth_id: String, > to_stdout: bool, > f: F, > ) -> Result > @@ -662,7 +662,7 @@ impl WorkerTask { > pub fn new_thread( > worker_type: &str, > worker_id: Option, > - auth_id: Authid, > + auth_id: String, > to_stdout: bool, > f: F, > ) -> Result > --=20 > 2.30.2 >=20 >=20 >=20 > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >=20 >=20 >=20