From 14cb2d19645cb2564281a421f2fc4dbf30bce979 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 26 Jul 2010 07:55:55 -0700 Subject: [PATCH] Fix unzip in usermin --- updown/updown-lib.pl | 14 ++++++++++++++ updown/upload.cgi | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/updown/updown-lib.pl b/updown/updown-lib.pl index 0853b6e8b..694206894 100755 --- a/updown/updown-lib.pl +++ b/updown/updown-lib.pl @@ -269,5 +269,19 @@ else { } } +# webmin_command_as_user(user, env, command) +# Return a command as some user with su if this is webmin, or un-changed for +# usermin +sub webmin_command_as_user +{ +my ($user, $env, @args) = @_; +if ($module_info{'usermin'}) { + return join(" ", @args); + } +else { + return &command_as_user($user, $env, @args); + } +} + 1; diff --git a/updown/upload.cgi b/updown/upload.cgi index 8c8e14421..7264bd276 100755 --- a/updown/upload.cgi +++ b/updown/upload.cgi @@ -83,7 +83,7 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) { $err = &text('upload_ecmd', "unzip"); } else { - open(OUT, &command_as_user($uinfo[0], 0, "(cd $qdir && unzip -o $qpath)")." 2>&1 &1 ) { $out .= $_; if (/^\s*[a-z]+:\s+(.*)/) { @@ -101,7 +101,7 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) { $err = &text('upload_ecmd', "tar"); } else { - open(OUT, &command_as_user($uinfo[0], 0, "(cd $qdir && tar xvf $qpath)")." 2>&1 &1 ) { $out .= $_; if (/^(.*)/) { @@ -119,7 +119,7 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) { $err = &text('upload_ecmd', "lha"); } else { - open(OUT, &command_as_user($uinfo[0], 0, "(cd $qdir && lha xf $qpath)")." 2>&1 &1 ) { $out .= $_; if (/(\S[^\t]*\S)\s+\-\s+/) { @@ -142,7 +142,7 @@ for($i=0; defined($d = $in{"upload$i"}); $i++) { $err = &text('upload_ecmd', $zipper); } else { - open(OUT, &command_as_user($uinfo[0], 0, "(cd $qdir && $zipper -c $qpath | tar xvf -)")." 2>&1 &1 ) { $out .= $_; if (/^(.*)/) {