freebsd-ports/print/pdfjam/files/patch-scripts-pdf90
Martin Wilke 12049643e6 - Fix insecure temporary files
PR:		based on 130028
Submitted by:	Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Approved by:	maintainer timeout
2009-01-12 12:32:51 +00:00

47 lines
1.5 KiB
Text

--- scripts/pdf90.orig 2005-01-25 22:19:21.000000000 +0300
+++ scripts/pdf90 2008-12-29 20:00:05.000000000 +0300
@@ -23,12 +23,18 @@
##
## First say where your "pdflatex" program lives:
##
-pdflatex=pdflatex
+pdflatex="__LOCALBASE__"/bin/pdflatex
#pdflatex="pdflatex.exe" ## this for Windows computers
##
## Next a permitted location for temporary files on your system:
##
-tempfileDir="/var/tmp" ## /var/tmp is standard on most unix systems
+## /var/tmp is standard on most unix systems
+tempfileDir=`mktemp -dq /var/tmp/pdf90.XXXXXXXX`
+if [ -z "$tempfileDir" ]; then
+ echo "pdf90: unable to create temporary directory"
+ exit 2
+fi
+trap "rm -rf -- \"$tempfileDir\"" 0 1 2 3 15
#tempfileDir="C:/tmp" ## use something like this under Windows
##
## Now specify the default settings for pdf90:
@@ -43,12 +49,12 @@
for d in /etc /usr/share/etc /usr/local/share /usr/local/etc
do if test -f $d/pdfnup.conf; then
echo "Reading site configuration from $d/pdfnup.conf"
- source $d/pdfnup.conf
+ . $d/pdfnup.conf
fi
done
if test -f ~/.pdfnup.conf; then
echo "Reading user defaults from ~/.pdfnup.conf";
- source ~/.pdfnup.conf;
+ . ~/.pdfnup.conf;
fi
#######################################################################
##
@@ -71,7 +77,7 @@
##
## Check that necessary LaTeX packages are installed
##
-PATH=`dirname "$pdflatex"`:$PATH
+PATH="$PATH":"__LOCALBASE__"/bin
export PATH
case `kpsewhich pdfpages.sty` in
"") echo "pdf90: pdfpages.sty not installed"; exit 1;;