summaryrefslogtreecommitdiff
path: root/mail/pine4/files/pgpdecode
diff options
context:
space:
mode:
authorSteve Price <steve@FreeBSD.org>1998-10-05 04:23:19 +0000
committerSteve Price <steve@FreeBSD.org>1998-10-05 04:23:19 +0000
commit6c5a81185b98298fd59c50d7213fa1d02896d59f (patch)
tree4d86acc88be5e417eb080b92831696978bdf2482 /mail/pine4/files/pgpdecode
parentRevert previous diff; we've found the XFree86 dist problem which really (diff)
Update to version 4.05.
PR: 7993, 8151 Submitted by: maintainer
Diffstat (limited to 'mail/pine4/files/pgpdecode')
-rw-r--r--mail/pine4/files/pgpdecode47
1 files changed, 42 insertions, 5 deletions
diff --git a/mail/pine4/files/pgpdecode b/mail/pine4/files/pgpdecode
index 86d5a97daa04..40625939c37c 100644
--- a/mail/pine4/files/pgpdecode
+++ b/mail/pine4/files/pgpdecode
@@ -6,9 +6,46 @@
# The tmp files in the original version were world readable for
# the short time of unpacking, setting suitable umask prevents this
#
+# Wed Sep 16 21:35:43 WST 1997 Anthony Di Pietro <anthony@dino.omen.com.au>
+# Modified to work with both PGP v2 and PGP v5.
+# Now uses mktemp to prevent symlink attack and tmp races.
+
umask 077
-trap "rm -f /tmp/pgpdecode.???.$$; exit" 0 1 2 15
-(pgp -f > /tmp/pgpdecode.txt.$$) 2>&1 | tee /tmp/pgpdecode.pgp.$$ 1>&2
-sed -e 's/^/| /' /tmp/pgpdecode.pgp.$$
-echo " "
-cat /tmp/pgpdecode.txt.$$
+
+MYNAME=`basename $0`
+
+STDOUT=`mktemp -q /tmp/${MYNAME}.XXXXXX`
+if [ $? -ne 0 ]
+then
+ echo "$0: Can't create temporary file to decode message."
+ exit 1
+fi
+
+trap "rm -f $STDOUT ; exit" 0 1 2 15
+
+STDERR=`mktemp -q /tmp/${MYNAME}.XXXXXX`
+if [ $? -ne 0 ]
+then
+ echo "$0: Can't create temporary file to decode message."
+ exit 1
+fi
+
+trap "rm -f $STDOUT $STDERR; exit" 0 1 2 15
+
+if [ -x /usr/local/bin/pgpv ]
+then
+ pgpv 2>&1 > $STDOUT |tee $STDERR > /dev/tty
+else
+ pgp -f 2>&1 > $STDOUT |tee $STDERR > /dev/tty
+fi
+
+cat $STDERR | \
+grep -v '^No files specified. Using stdin.$' | \
+grep -v '^Opening file \"stdout\" type text.$' | \
+grep -v '^Opening file \"stdout\" type binary.$' | \
+grep -v '^Opening file \"/dev/null\" type text.$' | \
+grep -v '^Opening file \"/dev/null\" type binary.$' | \
+grep -v '^$'| \
+sed -e 's/^/| /'
+echo ""
+cat $STDOUT