From ecb6b64f1848c56609740bb322247b4015998f1c Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 21 Sep 2021 12:14:19 +0200 Subject: [PATCH] src/server/worker_task.rs: Avoid using pbs-api-type::Authid Because we want to move worker_task.rs into proxmox-rest-server crate. --- pbs-api-types/src/upid.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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, Schema, StringSchema, Array use proxmox::const_regex; use proxmox::sys::linux::procfs; -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 { let pid = unsafe { libc::getpid() }; @@ -82,6 +80,10 @@ impl UPID { bail!("illegal characters in worker type '{}'", worker_type); } + if auth_id.contains(bad) { + bail!("illegal characters in auth_id '{}'", auth_id); + } + static WORKER_TASK_NEXT_ID: AtomicUsize = AtomicUsize::new(0); let task_id = WORKER_TASK_NEXT_ID.fetch_add(1, Ordering::SeqCst); @@ -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="Option::is_none")] pub endtime: Option, @@ -200,4 +202,3 @@ pub const NODE_TASKS_LIST_TASKS_RETURN_TYPE: ReturnType = ReturnType { &TaskListItem::API_SCHEMA, ).schema(), }; -