Remove redundant checks on symlink and archive commands
authorJacob Bachmeyer <jcb@gnu.org>
Sun, 9 Oct 2022 03:14:28 +0000 (22:14 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Sun, 9 Oct 2022 03:14:28 +0000 (22:14 -0500)
The tighter file name patterns now exclude ".." name components, so
these branches are now dead code.

gatekeeper.pl

index bef37b688756d0ac2c4aedc0bf68782af060ee48..00ebe043f76ac02b5c8701a2a465db4d58d293c2 100755 (executable)
@@ -1241,28 +1241,17 @@ sub read_directive_file {
       $tainted_val =~ /^($RE_filename_relative)\s+($RE_filename_relative)$/
        or fatal("invalid parameters for symlink command: $tainted_val",
                 1,$directive_file_contents);
-      my ($target,$link) = ($1,$2);  # so far so good
-      fatal("invalid parameters for symlink command(2): $tainted_val",
-           1,$directive_file_contents)
-       if ($target =~ /\.\./ || $link =~ /\.\./);
-      $info{"symlink-$target"} = {"link" => $link, "order" => $cnt++}; #ok.
+      # $1 -- link target      $2 -- link name
+      $info{"symlink-$1"} = {"link" => $2, "order" => $cnt++}; #ok.
     } elsif ($tainted_cmd =~ /^rmsymlink:?$/i) {
       $tainted_val =~ /^($RE_filename_relative)$/
        or fatal("invalid parameters for rmsymlink command: $tainted_val",
                 1,$directive_file_contents);
-      my $val = $1;  # so far so good
-      fatal("invalid parameters for rmsymlink command(2): $tainted_val",
-           1,$directive_file_contents)
-       if ($val =~ /\.\./);
       $info{"rmsymlink-$1"} = {"order" => $cnt++}; #ok.
     } elsif ($tainted_cmd =~ /^archive:?$/i) {
       $tainted_val =~ /^($RE_filename_relative)$/
        or fatal("invalid parameters for archive command: $tainted_val",
                 1,$directive_file_contents);
-      my $val = $1;  # so far so good
-      fatal("invalid parameters for archive command(2): $tainted_val",
-           1,$directive_file_contents)
-       if ($val =~ /\.\./);
       $info{"archive-$1"} = {"order" => $cnt++}; #ok.
     } elsif ($tainted_cmd =~ /^replace:?$/i) {
       # This command is only supported from v1.2