diff options
author | Olivier Blin <blino@mageia.org> | 2010-11-01 22:48:46 +0000 |
---|---|---|
committer | Olivier Blin <blino@mageia.org> | 2010-11-01 22:48:46 +0000 |
commit | 94c683bbaac00cdec9aaf1b781a5606daec243dd (patch) | |
tree | eccd33bd3647a46940480ed4642c2c1eb86be2f1 | |
parent | 0a5a6dfd0b89aecb70dfa4d8cf26ad7f5c4edc35 (diff) | |
download | iurt-94c683bbaac00cdec9aaf1b781a5606daec243dd.tar iurt-94c683bbaac00cdec9aaf1b781a5606daec243dd.tar.gz iurt-94c683bbaac00cdec9aaf1b781a5606daec243dd.tar.bz2 iurt-94c683bbaac00cdec9aaf1b781a5606daec243dd.tar.xz iurt-94c683bbaac00cdec9aaf1b781a5606daec243dd.zip |
simplify as check_path_authorized
-rwxr-xr-x | iurt_root_command | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/iurt_root_command b/iurt_root_command index b852be1..ce62f5c 100755 --- a/iurt_root_command +++ b/iurt_root_command @@ -308,8 +308,8 @@ sub ln { link $file1, $file2; } -sub check_tar_authorized { - my ($file, $dir) = @_; +sub check_path_authorized { + my ($path) = @_; if (!$ENV{SUDO_USER}) { plog('FAIL', "must be run from sudo"); return; @@ -319,8 +319,8 @@ sub check_tar_authorized { plog('FAIL', "can't find home for $ENV{SUDO_USER}"); return; } - if ($file !~ /^\Q$authorized\E/ || $dir !~ /^\Q$authorized\E/) { - plog('FAIL', "(un)tar: $file or $dir forbidden"); + if ($path !~ /^\Q$authorized\E/) { + plog('FAIL', "$path forbidden"); return; } @@ -333,7 +333,7 @@ sub tar { plog('FAIL', "tar: missing arguments"); return; } - check_tar_authorized($file, $dir) or return; + check_path_authorized($file) && check_path_authorized($dir) or return; return !system('tar', 'caf', $file, '-C', $dir, '.'); } @@ -343,7 +343,7 @@ sub untar { plog('FAIL', "untar: missing arguments"); return; } - check_tar_authorized($file, $dir) or return; + check_path_authorized($file) && check_path_authorized($dir) or return; if (any { /^-/ } @o_files) { plog('FAIL', "untar: options forbidden"); return; |