From 489c2506cd2fd51efa7b167248a378d07923abfe Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Thu, 21 Nov 2013 18:52:13 +0000 Subject: polkit: Fix support for several third party net management commands (mga#11286) --- lib/network/tools.pm | 10 +++++----- lib/network/vpn.pm | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/network') diff --git a/lib/network/tools.pm b/lib/network/tools.pm index cd7b69d..951b445 100644 --- a/lib/network/tools.pm +++ b/lib/network/tools.pm @@ -20,22 +20,22 @@ sub passwd_by_login { } sub run_interface_command { - my ($command, $intf, $detach) = @_; + my ($action, $intf, $detach) = @_; my @command = !$> || system("/usr/sbin/usernetctl $intf report") == 0 ? - ($command, $intf, if_(!$::isInstall, "daemon")) : - common::wrap_command_for_root($command, $intf); + ('/usr/sbin/if' . $action, $intf, if_(!$::isInstall, "daemon")) : + ('/usr/bin/pkexec', '/usr/sbin/if' . $action, $intf); run_program::raw({ detach => $detach, root => $::prefix }, @command); } sub start_interface { my ($intf, $detach) = @_; - run_interface_command('/sbin/ifup', $intf, $detach); + run_interface_command('up', $intf, $detach); } sub stop_interface { my ($intf, $detach) = @_; - run_interface_command('/sbin/ifdown', $intf, $detach); + run_interface_command('down', $intf, $detach); } sub start_net_interface { diff --git a/lib/network/vpn.pm b/lib/network/vpn.pm index 21142c8..147ecc8 100644 --- a/lib/network/vpn.pm +++ b/lib/network/vpn.pm @@ -113,8 +113,7 @@ sub get_config_path { sub _run { my ($connection, $action, @args) = @_; - my @command = ('vpn-' . $action, $connection->get_type, $connection->get_name, @args); - @command = common::wrap_command_for_root(@command) if $>; + my @command = (if_($>, '/usr/bin/pkexec'), '/usr/sbin/vpn-' . $action, $connection->get_type, $connection->get_name, @args); require run_program; run_program::rooted($::prefix, , @command); } -- cgit v1.2.1