taint: allow appendfile create_file option to specify a de-tainting safe path
[exim.git] / test / runtest
index ab9b2bb95485d9eebdca21f0abf6a1138523c500..6050411ed7eca99756e5dfa8a3b53f1dd4436b95 100755 (executable)
@@ -33,7 +33,7 @@ use File::Copy;
 
 use lib "$RealBin/lib";
 use Exim::Runtest;
-use Exim::Utils qw(uniq numerically);
+use Exim::Utils qw(uniq numerically cp);
 
 use if $ENV{DEBUG} && scalar($ENV{DEBUG} =~ /\bruntest\b/) => 'Smart::Comments' => '####';
 use if $ENV{DEBUG} && scalar($ENV{DEBUG} =~ /\bruntest\b/) => 'Data::Dumper';
@@ -749,7 +749,7 @@ RESET_AFTER_EXTRA_LINE_READ:
   s/remote delivery process \d+ ended/remote delivery process pppp ended/;
 
   # Pid in temp file in appendfile transport
-  s"test-mail/temp\.\d+\."test-mail/temp.pppp.";
+  s"test-mail/(subdir/)?temp\K\.\d+\.".pppp.";
 
   # Optional pid in log lines
   s/^(\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d)(\.\d{3}|)(\s[+-]\d{4}|)(\s\[\d+\])/
@@ -3746,17 +3746,15 @@ system("sudo cp eximdir/exim eximdir/exim_exim;" .
 ($parm_exim_dir) = $parm_exim =~ m?^(.*)/exim?;
 
 $dbm_build_deleted = 0;
-if (defined $parm_lookups{dbm} && not copy("$parm_exim_dir/exim_dbmbuild", "eximdir"))
+if (defined $parm_lookups{dbm} && not cp("$parm_exim_dir/exim_dbmbuild", "eximdir/exim_dbmbuild"))
   {
   delete $parm_lookups{dbm};
   $dbm_build_deleted = 1;
   }
 
 foreach my $tool (qw(exim_dumpdb exim_lock exinext exigrep eximstats)) {
-  copy("$parm_exim_dir/$tool" => "eximdir/")
+  cp("$parm_exim_dir/$tool" => "eximdir/$tool")
     or tests_exit(-1, "Failed to make a copy of $tool: $!");
-  chmod((stat "$parm_exim_dir/$tool")[2]&07777, "eximdir/$tool")
-    or tests_exit(-1, "Failed to chmod $tool: $!\n");
 }
 
 # Collect some version information