1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

SystemServer: Allow specifying per-service socket file permissions

This commit is contained in:
Andreas Kling 2020-01-09 21:35:33 +01:00
parent f3dad64a3b
commit 7dd03b46ee
3 changed files with 6 additions and 1 deletions

View file

@ -104,7 +104,7 @@ void Service::setup_socket()
ASSERT_NOT_REACHED();
}
if (fchmod(m_socket_fd, 0600) < 0) {
if (fchmod(m_socket_fd, m_socket_permissions) < 0) {
perror("fchmod");
ASSERT_NOT_REACHED();
}
@ -270,6 +270,8 @@ Service::Service(const CConfigFile& config, const StringView& name)
m_socket_path = config.read_entry(name, "Socket");
if (!m_socket_path.is_null()) {
auto socket_permissions_string = config.read_entry(name, "SocketPermissions", "0600");
m_socket_permissions = strtol(socket_permissions_string.characters(), nullptr, 8) & 04777;
setup_socket();
}
}