diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-01-20 12:27:56 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-23 12:48:26 +0000 |
commit | bcf4ec9c6152094a0a2abee37f4c6c92062998ba (patch) | |
tree | 55181d6346102ff902919bb2443c59081f2d6a7f | |
parent | da27937144f1d23bbca39c4e2f7a7bc1484b2dc1 (diff) | |
download | serenity-bcf4ec9c6152094a0a2abee37f4c6c92062998ba.zip |
Userland: Add promises to programs that will read /etc/timezone
This will require unveiling /etc/timezone itself for reading, as well as
the rpath pledge promise.
-rw-r--r-- | Userland/Applications/AnalogClock/main.cpp | 1 | ||||
-rw-r--r-- | Userland/Applications/Browser/main.cpp | 1 | ||||
-rw-r--r-- | Userland/Applications/Calendar/main.cpp | 1 | ||||
-rw-r--r-- | Userland/Services/WebContent/main.cpp | 1 | ||||
-rw-r--r-- | Userland/Utilities/cal.cpp | 3 | ||||
-rw-r--r-- | Userland/Utilities/date.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/ddate.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/fortune.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/w.cpp | 1 |
9 files changed, 10 insertions, 4 deletions
diff --git a/Userland/Applications/AnalogClock/main.cpp b/Userland/Applications/AnalogClock/main.cpp index 6e5b6030d9..719103410e 100644 --- a/Userland/Applications/AnalogClock/main.cpp +++ b/Userland/Applications/AnalogClock/main.cpp @@ -20,6 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath")); + TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index 33de4d1258..4de1e7faef 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -61,6 +61,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/home", "rwc")); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/etc/passwd", "r")); + TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil("/tmp/portal/image", "rw")); TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); TRY(Core::System::unveil("/tmp/portal/request", "rw")); diff --git a/Userland/Applications/Calendar/main.cpp b/Userland/Applications/Calendar/main.cpp index c76b9f8578..57aceb613e 100644 --- a/Userland/Applications/Calendar/main.cpp +++ b/Userland/Applications/Calendar/main.cpp @@ -27,6 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath", nullptr)); + TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); diff --git a/Userland/Services/WebContent/main.cpp b/Userland/Services/WebContent/main.cpp index 8bb754281c..2c51f2f761 100644 --- a/Userland/Services/WebContent/main.cpp +++ b/Userland/Services/WebContent/main.cpp @@ -16,6 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments) Core::EventLoop event_loop; TRY(Core::System::pledge("stdio recvfd sendfd accept unix rpath")); TRY(Core::System::unveil("/res", "r")); + TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil("/tmp/portal/request", "rw")); TRY(Core::System::unveil("/tmp/portal/image", "rw")); TRY(Core::System::unveil("/tmp/portal/websocket", "rw")); diff --git a/Userland/Utilities/cal.cpp b/Userland/Utilities/cal.cpp index 1174f4267a..28ce938d5b 100644 --- a/Userland/Utilities/cal.cpp +++ b/Userland/Utilities/cal.cpp @@ -90,7 +90,8 @@ static void clean_buffers() ErrorOr<int> serenity_main(Main::Arguments arguments) { - TRY(Core::System::pledge("stdio")); + TRY(Core::System::pledge("stdio rpath")); + TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil(nullptr, nullptr)); int day = 0; diff --git a/Userland/Utilities/date.cpp b/Userland/Utilities/date.cpp index 1298a9ed76..12d6bae420 100644 --- a/Userland/Utilities/date.cpp +++ b/Userland/Utilities/date.cpp @@ -13,7 +13,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { - TRY(Core::System::pledge("stdio settime", nullptr)); + TRY(Core::System::pledge("stdio settime rpath", nullptr)); bool print_unix_date = false; bool print_iso_8601 = false; diff --git a/Userland/Utilities/ddate.cpp b/Userland/Utilities/ddate.cpp index 261f363768..9e7d8ce66b 100644 --- a/Userland/Utilities/ddate.cpp +++ b/Userland/Utilities/ddate.cpp @@ -102,7 +102,7 @@ private: ErrorOr<int> serenity_main(Main::Arguments) { - TRY(Core::System::pledge("stdio")); + TRY(Core::System::pledge("stdio rpath")); auto date = Core::DateTime::now(); outln("Today is {}", DiscordianDate(date).to_string()); diff --git a/Userland/Utilities/fortune.cpp b/Userland/Utilities/fortune.cpp index 0475dd955c..324ec17874 100644 --- a/Userland/Utilities/fortune.cpp +++ b/Userland/Utilities/fortune.cpp @@ -84,7 +84,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly)); - TRY(Core::System::pledge("stdio")); + TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil(nullptr, nullptr)); auto file_contents = file->read_all(); diff --git a/Userland/Utilities/w.cpp b/Userland/Utilities/w.cpp index 31c52667c3..2d4ed240f1 100644 --- a/Userland/Utilities/w.cpp +++ b/Userland/Utilities/w.cpp @@ -20,6 +20,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::pledge("stdio rpath")); TRY(Core::System::unveil("/dev", "r")); TRY(Core::System::unveil("/etc/passwd", "r")); + TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil("/var/run/utmp", "r")); TRY(Core::System::unveil("/proc", "r")); TRY(Core::System::unveil(nullptr, nullptr)); |