From 9cfd1b1a67ac93ffaaa4789888b3d803a678b962 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 24 Jul 2022 12:04:31 +0200 Subject: [PATCH] LibCore: Make `Core::System::unveil` aware of %uid in path This brings support for user-dependent paths in `unveil`. --- Userland/Libraries/LibCore/System.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 70a3a7b3c5..e2f277cdcd 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -81,8 +82,10 @@ ErrorOr pledge(StringView promises, StringView execpromises) ErrorOr unveil(StringView path, StringView permissions) { + auto const parsed_path = Core::Account::parse_path_with_uid(path); + Syscall::SC_unveil_params params { - { path.characters_without_null_termination(), path.length() }, + { parsed_path.characters(), parsed_path.length() }, { permissions.characters_without_null_termination(), permissions.length() }, }; int rc = syscall(SC_unveil, ¶ms);