From 5c221cc78d47f76b6240da50e872adecc2bf6eaa Mon Sep 17 00:00:00 2001 From: Joerg Herbel Date: Fri, 23 Aug 2024 10:30:21 +0200 Subject: [PATCH] Windows: Reset permissions of plan working directories Since we don't delete the entire working directory anymore at scheduler start, it's not enough to grant permissions to the user configured for headed execution (if any). We also have to ensure that no other, previously configured user has access. CMK-18459 --- src/bin/scheduler/setup/general.rs | 19 ++++++++++++++++++- .../scheduler/setup/windows_permissions.rs | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/bin/scheduler/setup/general.rs b/src/bin/scheduler/setup/general.rs index 5ab9b945..3762c572 100644 --- a/src/bin/scheduler/setup/general.rs +++ b/src/bin/scheduler/setup/general.rs @@ -102,10 +102,27 @@ fn setup_plans_working_directory(plans: Vec) -> (Vec, Vec anyhow::Result<( }) } +pub fn reset_access(target_path: &Utf8Path) -> anyhow::Result<()> { + let arguments = [target_path.as_ref(), "/reset", "/T"]; + run_icacls_command(arguments).map_err(|e| { + let message = format!("Resetting permissions of {target_path} failed"); + e.context(message) + }) +} + pub fn adjust_rcc_file_permissions( rcc_config: &RCCConfig, rcc_plans: Vec,