summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Base/etc/SystemServer.ini7
-rw-r--r--Base/home/anon/.config/SystemServer.ini6
-rw-r--r--Userland/Applications/Help/main.cpp2
-rw-r--r--Userland/Applications/Mail/main.cpp2
-rw-r--r--Userland/Applications/Terminal/main.cpp2
-rw-r--r--Userland/Applications/TextEditor/main.cpp2
-rw-r--r--Userland/Demos/Eyes/main.cpp2
-rw-r--r--Userland/Games/2048/main.cpp2
-rw-r--r--Userland/Games/Chess/main.cpp2
-rw-r--r--Userland/Games/FlappyBug/main.cpp2
-rw-r--r--Userland/Games/GameOfLife/main.cpp2
-rw-r--r--Userland/Games/Hearts/main.cpp2
-rw-r--r--Userland/Games/MasterWord/main.cpp2
-rw-r--r--Userland/Games/Minesweeper/main.cpp2
-rw-r--r--Userland/Games/Snake/main.cpp2
-rw-r--r--Userland/Libraries/LibCore/Account.cpp5
-rw-r--r--Userland/Libraries/LibDesktop/Launcher.cpp2
-rw-r--r--Userland/Services/LoginServer/main.cpp3
-rw-r--r--Userland/Services/SystemServer/Service.cpp8
-rw-r--r--Userland/Services/SystemServer/Service.h1
-rw-r--r--Userland/Services/SystemServer/main.cpp15
21 files changed, 47 insertions, 26 deletions
diff --git a/Base/etc/SystemServer.ini b/Base/etc/SystemServer.ini
index 278eb2d5fc..736fe8f3af 100644
--- a/Base/etc/SystemServer.ini
+++ b/Base/etc/SystemServer.ini
@@ -71,13 +71,6 @@ Priority=low
KeepAlive=true
User=anon
-[LaunchServer]
-Socket=/tmp/portal/launch
-SocketPermissions=600
-Lazy=true
-User=anon
-SystemModes=text,graphical
-
[WindowServer]
Socket=/tmp/portal/window,/tmp/portal/wm
SocketPermissions=660
diff --git a/Base/home/anon/.config/SystemServer.ini b/Base/home/anon/.config/SystemServer.ini
index 31ca20d856..91927be505 100644
--- a/Base/home/anon/.config/SystemServer.ini
+++ b/Base/home/anon/.config/SystemServer.ini
@@ -1,3 +1,9 @@
+[LaunchServer]
+Socket=/tmp/100/portal/launch
+SocketPermissions=600
+Lazy=true
+SystemModes=text,graphical
+
[WorkspacePicker.Applet]
Priority=low
KeepAlive=true
diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp
index e91471d70b..12e0af993e 100644
--- a/Userland/Applications/Help/main.cpp
+++ b/Userland/Applications/Help/main.cpp
@@ -34,7 +34,7 @@ ErrorOr<int> 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/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 2396d21b34..8dc701955b 100644
--- a/Userland/Applications/Mail/main.cpp
+++ b/Userland/Applications/Mail/main.cpp
@@ -28,7 +28,7 @@ ErrorOr<int> 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/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 c0e0cedbc0..e91aa8923e 100644
--- a/Userland/Applications/Terminal/main.cpp
+++ b/Userland/Applications/Terminal/main.cpp
@@ -432,7 +432,7 @@ ErrorOr<int> 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/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 11e07a7911..53b5826ea6 100644
--- a/Userland/Applications/TextEditor/main.cpp
+++ b/Userland/Applications/TextEditor/main.cpp
@@ -32,7 +32,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
parser.parse(arguments);
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 594cef72d4..05312e3200 100644
--- a/Userland/Demos/Eyes/main.cpp
+++ b/Userland/Demos/Eyes/main.cpp
@@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app = TRY(GUI::Application::try_create(arguments));
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 89faf47377..bd9b64f3e2 100644
--- a/Userland/Games/2048/main.cpp
+++ b/Userland/Games/2048/main.cpp
@@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 374aa2b9b8..a323cdc151 100644
--- a/Userland/Games/Chess/main.cpp
+++ b/Userland/Games/Chess/main.cpp
@@ -41,7 +41,7 @@ ErrorOr<int> 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/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/100/portal/launch", "rw"));
TRY(Core::System::unveil(Core::StandardPaths::home_directory(), "wcbr"sv));
TRY(Core::System::unveil(nullptr, nullptr));
diff --git a/Userland/Games/FlappyBug/main.cpp b/Userland/Games/FlappyBug/main.cpp
index 91b38b18cd..8792b9e55e 100644
--- a/Userland/Games/FlappyBug/main.cpp
+++ b/Userland/Games/FlappyBug/main.cpp
@@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 4528393396..135cee17ef 100644
--- a/Userland/Games/GameOfLife/main.cpp
+++ b/Userland/Games/GameOfLife/main.cpp
@@ -37,7 +37,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 9934a5cfa4..513798bdf0 100644
--- a/Userland/Games/Hearts/main.cpp
+++ b/Userland/Games/Hearts/main.cpp
@@ -41,7 +41,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 9ee712ad4e..82f8a6acce 100644
--- a/Userland/Games/MasterWord/main.cpp
+++ b/Userland/Games/MasterWord/main.cpp
@@ -33,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 2423070239..883271acc4 100644
--- a/Userland/Games/Minesweeper/main.cpp
+++ b/Userland/Games/Minesweeper/main.cpp
@@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 259583f4af..a8f3173385 100644
--- a/Userland/Games/Snake/main.cpp
+++ b/Userland/Games/Snake/main.cpp
@@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath recvfd sendfd"));
TRY(Core::System::unveil("/res", "r"));
- TRY(Core::System::unveil("/tmp/portal/launch", "rw"));
+ TRY(Core::System::unveil("/tmp/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 98cbd41bdd..a7e34e3b3b 100644
--- a/Userland/Libraries/LibCore/Account.cpp
+++ b/Userland/Libraries/LibCore/Account.cpp
@@ -10,6 +10,7 @@
#include <AK/Random.h>
#include <AK/ScopeGuard.h>
#include <LibCore/Account.h>
+#include <LibCore/Directory.h>
#include <LibCore/System.h>
#include <LibCore/UmaskScope.h>
#include <errno.h>
@@ -150,6 +151,10 @@ 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 e4add1ac9b..5169bc7257 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<LaunchClientEndpoint, LaunchServerEndpoint>
, public LaunchClientEndpoint {
- IPC_CLIENT_CONNECTION(ConnectionToLaunchServer, "/tmp/portal/launch")
+ IPC_CLIENT_CONNECTION(ConnectionToLaunchServer, "/tmp/100/portal/launch")
private:
ConnectionToLaunchServer(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
: IPC::ConnectionToServer<LaunchClientEndpoint, LaunchServerEndpoint>(*this, move(socket))
diff --git a/Userland/Services/LoginServer/main.cpp b/Userland/Services/LoginServer/main.cpp
index 1b4bb2392a..66f922c1f0 100644
--- a/Userland/Services/LoginServer/main.cpp
+++ b/Userland/Services/LoginServer/main.cpp
@@ -56,8 +56,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
{
auto app = TRY(GUI::Application::try_create(arguments));
- TRY(Core::System::pledge("stdio recvfd sendfd rpath exec proc id"));
+ TRY(Core::System::pledge("stdio recvfd sendfd cpath rpath exec proc id"));
TRY(Core::System::unveil("/home", "r"));
+ TRY(Core::System::unveil("/tmp", "c"));
TRY(Core::System::unveil("/etc/passwd", "r"));
TRY(Core::System::unveil("/etc/shadow", "r"));
TRY(Core::System::unveil("/etc/group", "r"));
diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp
index 0749ca6231..f2d1c2dde2 100644
--- a/Userland/Services/SystemServer/Service.cpp
+++ b/Userland/Services/SystemServer/Service.cpp
@@ -416,3 +416,11 @@ ErrorOr<void> Service::determine_account(int fd)
m_account = TRY(Core::Account::from_uid(stat.st_uid));
return {};
}
+
+Service::~Service()
+{
+ for (auto& socket : m_sockets) {
+ if (auto rc = remove(socket.path.characters()); rc != 0)
+ dbgln("{}", Error::from_errno(errno));
+ }
+}
diff --git a/Userland/Services/SystemServer/Service.h b/Userland/Services/SystemServer/Service.h
index 42920cf2c8..79c2967838 100644
--- a/Userland/Services/SystemServer/Service.h
+++ b/Userland/Services/SystemServer/Service.h
@@ -18,6 +18,7 @@ class Service final : public Core::Object {
public:
static ErrorOr<NonnullRefPtr<Service>> try_create(Core::ConfigFile const& config, StringView name);
+ ~Service();
bool is_enabled() const;
void activate();
diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp
index 2759747d44..c2ae144d76 100644
--- a/Userland/Services/SystemServer/main.cpp
+++ b/Userland/Services/SystemServer/main.cpp
@@ -30,6 +30,13 @@
#include <unistd.h>
String g_system_mode = "graphical";
+NonnullRefPtrVector<Service> g_services;
+
+// NOTE: This handler ensures that the destructor of g_services is called.
+static void sigterm_handler(int)
+{
+ exit(0);
+}
static void sigchld_handler(int)
{
@@ -480,22 +487,22 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Core::EventLoop event_loop;
event_loop.register_signal(SIGCHLD, sigchld_handler);
+ event_loop.register_signal(SIGTERM, sigterm_handler);
// Read our config and instantiate services.
// This takes care of setting up sockets.
- NonnullRefPtrVector<Service> services;
auto config = (user)
? TRY(Core::ConfigFile::open_for_app("SystemServer"))
: TRY(Core::ConfigFile::open_for_system("SystemServer"));
for (auto const& name : config->groups()) {
auto service = TRY(Service::try_create(*config, name));
if (service->is_enabled())
- services.append(service);
+ g_services.append(move(service));
}
// After we've set them all up, activate them!
- dbgln("Activating {} services...", services.size());
- for (auto& service : services)
+ dbgln("Activating {} services...", g_services.size());
+ for (auto& service : g_services)
service.activate();
return event_loop.exec();