Fix bug in extracting zip files in chroot mode
authorJamie Cameron <jcameron@webmin.com>
Sat, 14 Jun 2008 00:56:20 +0000 (00:56 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sat, 14 Jun 2008 00:56:20 +0000 (00:56 +0000)
file/file-lib.pl

index 31e1f1c..212840a 100644 (file)
@@ -261,7 +261,9 @@ return @rv;
 
 sub open_trust_db
 {
-local $trust = "$ENV{'WEBMIN_CONFIG'}/file/trust";
+local $trust = $ENV{'WEBMIN_CONFIG'} =~ /\/usermin/ ?
+       "/tmp/trust.$ENV{'REMOTE_USER'}" :
+       "$ENV{'WEBMIN_CONFIG'}/file/trust";
 eval "use SDBM_File";
 dbmopen(%trustdb, $trust, 0700);
 eval { $trustdb{'1111111111'} = 'foo bar' };
@@ -291,8 +293,8 @@ else {
 }
 
 # extract_archive(path, delete)
-# Called by upload to extract some zip or tar.gz file. Returns undef if something
-# was actually done, an error message otherwise.
+# Called by upload to extract some zip or tar.gz file. Returns undef if
+# something was actually done, an error message otherwise.
 sub extract_archive
 {
 local $out;
@@ -360,7 +362,7 @@ elsif ($unarchive == 0) {
 local $refresh = $path;
 local $err;
 if ($zip) {
-       $err = &extract_archive($path, $zip-1);
+       $err = &extract_archive(&unmake_chroot($path), $zip-1);
        if (!$err) {
                # Refresh whole dir
                $refresh = $in{'dir'};