2020-10-03 10:55:51 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-10-03 10:55:51 -03:00
|
|
|
*/
|
|
|
|
|
|
2021-01-31 11:10:45 -03:00
|
|
|
#include "ClientConnection.h"
|
2020-10-03 10:55:51 -03:00
|
|
|
#include <AK/LexicalPath.h>
|
|
|
|
|
#include <LibCore/EventLoop.h>
|
|
|
|
|
#include <LibCore/File.h>
|
|
|
|
|
#include <LibCore/LocalServer.h>
|
|
|
|
|
#include <LibIPC/ClientConnection.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
int main(int, char**)
|
|
|
|
|
{
|
|
|
|
|
Core::EventLoop event_loop;
|
2020-11-21 16:12:37 -03:00
|
|
|
if (pledge("stdio unix rpath recvfd", nullptr) < 0) {
|
2020-10-03 10:55:51 -03:00
|
|
|
perror("pledge");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
|
|
|
|
|
IPC::new_client_connection<LanguageServers::Shell::ClientConnection>(socket.release_nonnull(), 1);
|
2020-11-21 16:12:37 -03:00
|
|
|
if (pledge("stdio rpath recvfd", nullptr) < 0) {
|
2020-10-03 10:55:51 -03:00
|
|
|
perror("pledge");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2020-11-21 16:12:37 -03:00
|
|
|
if (unveil("/etc/passwd", "r") < 0) {
|
|
|
|
|
perror("unveil");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (unveil("/", "b") < 0) {
|
|
|
|
|
perror("unveil");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2020-10-03 10:55:51 -03:00
|
|
|
return event_loop.exec();
|
|
|
|
|
}
|