# The 'install' op carries the name of the file to install, while the
# 'filename' element binds the directive signature to its intended
# upload. These are assumed to be the same in protocol 1.2 and earlier.
- my $cnt = 0; # TODO: remove this
{ # Extract version first, since directive elements may be in any order.
my @versions = grep $_->[0] eq 'version', @$directive;
if (($val ne '1.1') and ($val ne '1.2'));
$header{version} = $val; # TODO: parse?
- $info{"version"} = $val; #ok.
} elsif (scalar @versions > 1) {
push @errors, "invalid multiple version elements";
} else { # no version at all; no longer allowed
$header{directory} = $val; # ok.
$header{package} = $dirs[0]; # top-level name, no subdir
- $info{directory} = $header{directory};
$info{package} = $header{package};
} elsif ($tainted_cmd eq 'filename') {
# We use the same filename restrictions as scan_incoming
}
$header{filename} = $val;
- $info{"filename"} = {"value" => $val, "order" => $cnt++}; # ok.
} elsif ($tainted_cmd eq 'version') {
# already handled above
} elsif ($tainted_cmd eq 'symlink') {
}
# $1 -- link target $2 -- link name
push @ops, [symlink => $1, $2];
- $info{"symlink-$1"} = {"link" => $2, "order" => $cnt++}; #ok.
} elsif ($tainted_cmd eq 'rmsymlink') {
unless ($tainted_val =~ /^($RE_filename_relative)$/) {
push @errors, "invalid parameters for rmsymlink command: $tainted_val";
next;
}
push @ops, [rmsymlink => $1];
- $info{"rmsymlink-$1"} = {"order" => $cnt++}; #ok.
} elsif ($tainted_cmd eq 'archive') {
unless ($tainted_val =~ /^($RE_filename_relative)$/) {
push @errors,
next;
}
push @ops, [archive => $1];
- $info{"archive-$1"} = {"order" => $cnt++}; #ok.
} elsif ($tainted_cmd eq 'replace') {
# This command is only supported from v1.2
unless ($tainted_val =~ /^(true|false)$/) {
}
$options{replace} = ($1 eq 'true');
- $info{"replace"} = $1; #ok.
} elsif ($tainted_cmd eq 'comment') {
# Comments are ok, we ignore them
} elsif (IN_TEST_MODE && $tainted_cmd eq 'no-op') {
# The testsuite uses a no-op command to validate directive processing.
push @ops, ['no-op'];
- $info{'no-op'} = {order => $cnt++};
} else {
push @errors, "Invalid directive line:\n\n $tainted_cmd $tainted_val";
}