summaryrefslogtreecommitdiff
path: root/Build/source/extra
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-03-08 21:08:16 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2010-03-08 21:08:16 +0000
commit5d748b68d77bc6f3bf05eb9abbf7e7071a124449 (patch)
treeed9f16c762fda670ab312987544b2b8bc88ba507 /Build/source/extra
parent555d402ce229538a57ad43fc2ca50d7bbb533486 (diff)
epstopdf: forbid --gscmd in restricted mode.
git-svn-id: svn://tug.org/texlive/trunk@17386 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/extra')
-rw-r--r--Build/source/extra/epstopdf/epstopdf.16
-rwxr-xr-xBuild/source/extra/epstopdf/epstopdf.pl32
2 files changed, 13 insertions, 25 deletions
diff --git a/Build/source/extra/epstopdf/epstopdf.1 b/Build/source/extra/epstopdf/epstopdf.1
index 3f410dc7bd4..4b368c9c1f7 100644
--- a/Build/source/extra/epstopdf/epstopdf.1
+++ b/Build/source/extra/epstopdf/epstopdf.1
@@ -42,9 +42,9 @@ set AutoRotatePages (default: None); recognized \fIval\fP choices:
None, All, PageByPage. For EPS files, PageByPage is equivalent to All.
.IP "\fB--restricted\fP=\fIval\fP"
turn on restricted mode (default: [on for repstopdf, else off]);
-this restricts the values accepted by \fB--gscmd\fP and impose restrictions
-on the input and output file names similar to Web2c's openin_any=p and
-openout_any=p.
+this forbids the use of \fB--gscmd\fP and imposes restrictions on the input and
+output file names according to the values of openin_any and openout_any (see
+Web2c's manual).
.IP "\fB--help\fP
display help message and exit
.IP "\fB--version\fP
diff --git a/Build/source/extra/epstopdf/epstopdf.pl b/Build/source/extra/epstopdf/epstopdf.pl
index 8a41393d926..286ad89ad0b 100755
--- a/Build/source/extra/epstopdf/epstopdf.pl
+++ b/Build/source/extra/epstopdf/epstopdf.pl
@@ -46,6 +46,9 @@ use strict;
#
# emacs-page
# History
+# 2010/03/08 (Manuel P\'egouri\'e-Gonnard)
+# * In restricted mode, forbid --gscmd (all platforms) and call GS with full
+# path relative to self location (windows).
# 2010/02/26 v2.13 (Karl Berry)
# * New release.
# 2010/02/23 (Manuel P\'egouri\'e-Gonnard)
@@ -244,29 +247,17 @@ sub errorUsage { die "Error: @_ (try --help for more information)\n"; }
$restricted = 1 if $::opt_restricted;
debug "Restricted mode activated" if $restricted;
-### safe kpsewhich command for windows
+### safer external commands for windows in restricted mode
my $kpsewhich = 'kpsewhich';
if ($restricted and ($^O eq 'MSWin32')) {
use File::Basename;
my $mydirname = dirname $0;
# $mydirname is the location of the Perl script
$kpsewhich = "$mydirname/../../../bin/win32/$kpsewhich";
+ $GS = "$mydirname/../../../tlpkg/tlgs/bin/$GS";
}
debug "kpsewhich command: $kpsewhich";
-### find a executable (.exe) in the PATH on windows, or bail out in error
-sub make_full_path_w32
-{
- my ($name) = @_;
- $name = "$name.exe" unless $name =~ /\.exe$/;
- my $path = $ENV{'PATH'};
- for my $path_elt (split(/;/, $path)) {
- my $fullname = "$path_elt/$name";
- return $fullname if -e $fullname;
- }
- error "Program $name not found in PATH\n($path)";
-}
-
### check if a name is "safe" according to kpse's open(in|out)_any
# return true if name is ok, false otherwise
sub safe_name
@@ -310,16 +301,13 @@ if ($::opt_filter) {
### emacs-page
### option gscmd
if ($::opt_gscmd) {
- debug "Switching from $GS to $::opt_gscmd";
- $GS = $::opt_gscmd;
- # validate GS \label{val_gscmd}
- if ($restricted) {
- $GS =~ /^(gs|mgs|gswin32c|gs386|gsos2)$/
- or $GS =~ /^gs[\-_]?(\d|\d[\.-_]?\d\d)c?$/
- or error "gscmd value not allowed in restricted mode: $GS";
+ if ($restricted) { # \label{val_gscmd}
+ error "Option forbidden in restricted mode: --gscmd";
+ } else {
+ debug "Switching from $GS to $::opt_gscmd";
+ $GS = $::opt_gscmd;
}
}
-$GS = make_full_path_w32($GS) if $restricted and ($^O eq 'MSWin32');
### start building GS command line for the pipe
my @GS = ($GS);