From d967275cb5d9c7c3c773a3d7d745fa649df86b3d Mon Sep 17 00:00:00 2001 From: Matteo Pasotti Date: Mon, 19 Aug 2013 19:21:18 +0200 Subject: - drop USE_* variables (configurable privileges method) --- AdminPanel/Privileges.pm | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/AdminPanel/Privileges.pm b/AdminPanel/Privileges.pm index f6db9d4..73f2098 100644 --- a/AdminPanel/Privileges.pm +++ b/AdminPanel/Privileges.pm @@ -26,18 +26,11 @@ use base qw(Exporter); use English qw(-no_match_vars); our @EXPORT = qw(require_root_capability - ask_for_authentication - $USE_SUDO - $USE_PKIT - $USE_CHLP); + ask_for_authentication); -our $USE_SUDO = 1; -our $USE_PKIT = 2; -our $USE_CHLP = 3; - -my $wrappers = { $USE_SUDO => "sudo", - $USE_PKIT => "pkexec", - $USE_CHLP => "consolehelper" +my $wrappers = { "sudo" => "sudo", + "pkit" => "pkexec", + "chlp" => "consolehelper" }; my $wrapper = 0; @@ -51,7 +44,7 @@ sub ask_for_authentication { $wrapper = $wrappers->{$wrapper_id} if(defined($wrappers->{$wrapper_id})); my ($command, @args) = wrap_command($0, @ARGV); unshift(@args,$command->[1]); - unshift(@args, '-n') if($wrapper_id == $USE_SUDO); # let sudo die if password is needed + unshift(@args, '-n') if($wrapper_id eq "sudo"); # let sudo die if password is needed exec { $command->[0] } $command->[1], @args or die ("command %s missing", $command->[0]); } -- cgit v1.2.1