mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:55:06 +00:00
Userland+Base: Don't run NetworkSettings in elevated mode
This commit is contained in:
parent
24b1bdca27
commit
b01fcccbbd
4 changed files with 2 additions and 10 deletions
|
@ -1,7 +1,6 @@
|
||||||
[App]
|
[App]
|
||||||
Name=Network Settings
|
Name=Network Settings
|
||||||
Executable=/bin/NetworkSettings
|
Executable=/bin/NetworkSettings
|
||||||
RequiresRoot=true
|
|
||||||
Category=Settings
|
Category=Settings
|
||||||
Description=Configure network connections
|
Description=Configure network connections
|
||||||
ExcludeFromSystemMenu=true
|
ExcludeFromSystemMenu=true
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
|
|
||||||
#include "NetworkSettingsWidget.h"
|
#include "NetworkSettingsWidget.h"
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibGUI/MessageBox.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
|
@ -35,11 +32,6 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
||||||
|
|
||||||
auto app = TRY(GUI::Application::create(args));
|
auto app = TRY(GUI::Application::create(args));
|
||||||
|
|
||||||
if (getuid() != 0) {
|
|
||||||
GUI::MessageBox::show_error(nullptr, "You need to be root to run Network Settings!"sv);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd proc exec"));
|
TRY(Core::System::pledge("stdio rpath wpath cpath recvfd sendfd proc exec"));
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("network"sv);
|
auto app_icon = GUI::Icon::default_icon("network"sv);
|
||||||
|
|
|
@ -76,7 +76,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
||||||
"Open in Network Settings...", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/network.png"sv)), [this](GUI::Action&) {
|
"Open in Network Settings...", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/network.png"sv)), [this](GUI::Action&) {
|
||||||
m_adapter_table_view->selection().for_each_index([this](GUI::ModelIndex const& index) {
|
m_adapter_table_view->selection().for_each_index([this](GUI::ModelIndex const& index) {
|
||||||
auto adapter_name = index.sibling_at_column(1).data().as_string();
|
auto adapter_name = index.sibling_at_column(1).data().as_string();
|
||||||
GUI::Process::spawn_or_show_error(window(), "/bin/Escalator"sv, Array { "/bin/NetworkSettings", adapter_name.characters() });
|
GUI::Process::spawn_or_show_error(window(), "/bin/NetworkSettings"sv, Array { adapter_name.characters() });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
this));
|
this));
|
||||||
|
|
|
@ -248,6 +248,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
TRY(Core::System::unveil("/dev", "r"));
|
TRY(Core::System::unveil("/dev", "r"));
|
||||||
TRY(Core::System::unveil("/bin", "r"));
|
TRY(Core::System::unveil("/bin", "r"));
|
||||||
TRY(Core::System::unveil("/bin/Escalator", "x"));
|
TRY(Core::System::unveil("/bin/Escalator", "x"));
|
||||||
|
TRY(Core::System::unveil("/bin/NetworkSettings", "x"));
|
||||||
TRY(Core::System::unveil("/usr/lib", "r"));
|
TRY(Core::System::unveil("/usr/lib", "r"));
|
||||||
|
|
||||||
// This directory only exists if ports are installed
|
// This directory only exists if ports are installed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue