diff --git a/Base/home/anon/.config/SystemServer.ini b/Base/home/anon/.config/SystemServer.ini index 91927be505a..ac9f6f71664 100644 --- a/Base/home/anon/.config/SystemServer.ini +++ b/Base/home/anon/.config/SystemServer.ini @@ -1,5 +1,5 @@ [LaunchServer] -Socket=/tmp/100/portal/launch +Socket=/tmp/user/100/portal/launch SocketPermissions=600 Lazy=true SystemModes=text,graphical diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp index 12e0af993e5..654ef0fee00 100644 --- a/Userland/Applications/Help/main.cpp +++ b/Userland/Applications/Help/main.cpp @@ -34,7 +34,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/usr/share/man", "r")); TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); diff --git a/Userland/Applications/Mail/main.cpp b/Userland/Applications/Mail/main.cpp index 8dc701955b1..98afeb35174 100644 --- a/Userland/Applications/Mail/main.cpp +++ b/Userland/Applications/Mail/main.cpp @@ -28,7 +28,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/etc", "r")); TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); TRY(Desktop::Launcher::add_allowed_url(URL::create_with_file_protocol("/bin/MailSettings"))); diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index 404323b5cdc..ac3d84e9e15 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -432,7 +432,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/bin/TerminalSettings", "x")); TRY(Core::System::unveil("/bin/utmpupdate", "x")); TRY(Core::System::unveil("/etc/FileIconProvider.ini", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil("/tmp/portal/config", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); diff --git a/Userland/Applications/TextEditor/main.cpp b/Userland/Applications/TextEditor/main.cpp index 53b5826ea63..90225e365dc 100644 --- a/Userland/Applications/TextEditor/main.cpp +++ b/Userland/Applications/TextEditor/main.cpp @@ -32,7 +32,7 @@ ErrorOr serenity_main(Main::Arguments arguments) parser.parse(arguments); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); diff --git a/Userland/Demos/Eyes/main.cpp b/Userland/Demos/Eyes/main.cpp index 05312e32009..2b13e1a41cd 100644 --- a/Userland/Demos/Eyes/main.cpp +++ b/Userland/Demos/Eyes/main.cpp @@ -38,7 +38,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); if ((grid_rows > 0) ^ (grid_columns > 0)) { diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp index bd9b64f3e28..4379297c140 100644 --- a/Userland/Games/2048/main.cpp +++ b/Userland/Games/2048/main.cpp @@ -45,7 +45,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); size_t board_size = Config::read_i32("2048"sv, ""sv, "board_size"sv, 4); diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp index 8fe0d46f2b3..3f91cf3da5c 100644 --- a/Userland/Games/Chess/main.cpp +++ b/Userland/Games/Chess/main.cpp @@ -39,7 +39,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/bin/ChessEngine", "x")); TRY(Core::System::unveil("/etc/passwd", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil("/tmp/portal/filesystemaccess", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); diff --git a/Userland/Games/FlappyBug/main.cpp b/Userland/Games/FlappyBug/main.cpp index 8792b9e55ed..ce059f7caf2 100644 --- a/Userland/Games/FlappyBug/main.cpp +++ b/Userland/Games/FlappyBug/main.cpp @@ -31,7 +31,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); u32 high_score = Config::read_i32("FlappyBug"sv, "Game"sv, "HighScore"sv, 0); diff --git a/Userland/Games/GameOfLife/main.cpp b/Userland/Games/GameOfLife/main.cpp index 135cee17ef7..5a683504716 100644 --- a/Userland/Games/GameOfLife/main.cpp +++ b/Userland/Games/GameOfLife/main.cpp @@ -37,7 +37,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-gameoflife"sv)); diff --git a/Userland/Games/Hearts/main.cpp b/Userland/Games/Hearts/main.cpp index 513798bdf00..b9c013fa688 100644 --- a/Userland/Games/Hearts/main.cpp +++ b/Userland/Games/Hearts/main.cpp @@ -41,7 +41,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio recvfd sendfd rpath")); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); auto window = TRY(GUI::Window::try_create()); diff --git a/Userland/Games/MasterWord/main.cpp b/Userland/Games/MasterWord/main.cpp index 82f8a6acce7..3f87669ac1c 100644 --- a/Userland/Games/MasterWord/main.cpp +++ b/Userland/Games/MasterWord/main.cpp @@ -33,7 +33,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-masterword"sv)); diff --git a/Userland/Games/Minesweeper/main.cpp b/Userland/Games/Minesweeper/main.cpp index 91d5a5fd598..190f1d10f3a 100644 --- a/Userland/Games/Minesweeper/main.cpp +++ b/Userland/Games/Minesweeper/main.cpp @@ -39,7 +39,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-minesweeper"sv)); diff --git a/Userland/Games/Snake/main.cpp b/Userland/Games/Snake/main.cpp index a8f3173385a..e65341d9399 100644 --- a/Userland/Games/Snake/main.cpp +++ b/Userland/Games/Snake/main.cpp @@ -34,7 +34,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); - TRY(Core::System::unveil("/tmp/100/portal/launch", "rw")); + TRY(Core::System::unveil("/tmp/user/100/portal/launch", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-snake"sv)); diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp index a7e34e3b3b1..715721570aa 100644 --- a/Userland/Libraries/LibCore/Account.cpp +++ b/Userland/Libraries/LibCore/Account.cpp @@ -142,6 +142,15 @@ bool Account::authenticate(SecretString const& password) const bool Account::login() const { + auto const temporary_directory = String::formatted("/tmp/user/{}", m_uid); + if (auto result = Core::Directory::create(temporary_directory, Core::Directory::CreateDirectories::Yes); result.is_error()) { + dbgln("{}", result.release_error()); + return false; + } + + if (chown(temporary_directory.characters(), m_uid, m_gid) < 0) + return false; + if (setgroups(m_extra_gids.size(), m_extra_gids.data()) < 0) return false; @@ -151,10 +160,6 @@ bool Account::login() const if (setuid(m_uid) < 0) return false; - auto const temporary_directory = String::formatted("/tmp/{}", m_uid); - if (auto result = Core::Directory::create(temporary_directory, Core::Directory::CreateDirectories::No); result.is_error()) - dbgln("{}", result.release_error()); - return true; } diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp index 5169bc72579..6dc00d0a05b 100644 --- a/Userland/Libraries/LibDesktop/Launcher.cpp +++ b/Userland/Libraries/LibDesktop/Launcher.cpp @@ -36,7 +36,7 @@ auto Launcher::Details::from_details_str(String const& details_str) -> NonnullRe class ConnectionToLaunchServer final : public IPC::ConnectionToServer , public LaunchClientEndpoint { - IPC_CLIENT_CONNECTION(ConnectionToLaunchServer, "/tmp/100/portal/launch") + IPC_CLIENT_CONNECTION(ConnectionToLaunchServer, "/tmp/user/100/portal/launch") private: ConnectionToLaunchServer(NonnullOwnPtr socket) : IPC::ConnectionToServer(*this, move(socket)) diff --git a/Userland/Services/LoginServer/main.cpp b/Userland/Services/LoginServer/main.cpp index 66f922c1f0c..8b539c95405 100644 --- a/Userland/Services/LoginServer/main.cpp +++ b/Userland/Services/LoginServer/main.cpp @@ -56,7 +56,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { auto app = TRY(GUI::Application::try_create(arguments)); - TRY(Core::System::pledge("stdio recvfd sendfd cpath rpath exec proc id")); + TRY(Core::System::pledge("stdio recvfd sendfd cpath chown rpath exec proc id")); TRY(Core::System::unveil("/home", "r")); TRY(Core::System::unveil("/tmp", "c")); TRY(Core::System::unveil("/etc/passwd", "r"));