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.
This commit is contained in:
Timothy Flynn 2022-01-20 12:27:56 -05:00 committed by Linus Groh
parent da27937144
commit bcf4ec9c61
9 changed files with 10 additions and 4 deletions

View file

@ -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));

View file

@ -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"));

View file

@ -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));

View file

@ -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"));

View file

@ -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;

View file

@ -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;

View file

@ -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());

View file

@ -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();

View file

@ -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));