2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2019-11-26 13:38:24 -03:00
|
|
|
#include "LookupServer.h"
|
2020-02-06 11:04:03 -03:00
|
|
|
#include <LibCore/EventLoop.h>
|
2020-02-14 18:29:06 -03:00
|
|
|
#include <LibCore/LocalServer.h>
|
2020-01-12 21:46:03 -03:00
|
|
|
#include <stdio.h>
|
2021-03-12 13:29:37 -03:00
|
|
|
#include <unistd.h>
|
2019-06-20 16:48:33 -03:00
|
|
|
|
2020-12-20 20:09:48 -03:00
|
|
|
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
2019-06-20 16:48:33 -03:00
|
|
|
{
|
2021-05-13 18:20:26 -03:00
|
|
|
if (pledge("stdio accept unix inet rpath", nullptr) < 0) {
|
2020-01-12 21:46:03 -03:00
|
|
|
perror("pledge");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-02 08:34:39 -03:00
|
|
|
Core::EventLoop event_loop;
|
2021-02-04 13:07:45 -03:00
|
|
|
auto server = LookupServer::LookupServer::construct();
|
2019-03-19 12:29:06 -03:00
|
|
|
|
2021-05-04 08:47:42 -03:00
|
|
|
if (pledge("stdio accept inet rpath", nullptr) < 0) {
|
2020-01-12 21:46:03 -03:00
|
|
|
perror("pledge");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-06 08:34:36 -03:00
|
|
|
if (unveil("/proc/net/adapters", "r") < 0) {
|
|
|
|
|
perror("unveil");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-07 15:26:09 -03:00
|
|
|
if (unveil("/etc/hosts", "r") < 0) {
|
|
|
|
|
perror("unveil");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-06 08:34:36 -03:00
|
|
|
if (unveil(nullptr, nullptr) < 0) {
|
|
|
|
|
perror("unveil");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2020-01-22 07:13:52 -03:00
|
|
|
|
2019-11-26 13:38:24 -03:00
|
|
|
return event_loop.exec();
|
2019-03-19 12:29:06 -03:00
|
|
|
}
|