summaryrefslogtreecommitdiff
path: root/mail/pine4-ssl/files/pgpdecode
diff options
context:
space:
mode:
authorNick Sayer <nsayer@FreeBSD.org>1999-06-23 07:30:55 +0000
committerNick Sayer <nsayer@FreeBSD.org>1999-06-23 07:30:55 +0000
commite8b984175a5d7372e7c9ac10022a98955df702d9 (patch)
tree6077b65061687ff2d819be89bb47b7e9bc2516e2 /mail/pine4-ssl/files/pgpdecode
parentFixed a bug which I made (.endfi -> .endif) (diff)
Second try at importing the pine4 + SSL port
Notes
Notes: svn path=/head/; revision=19713
Diffstat (limited to 'mail/pine4-ssl/files/pgpdecode')
-rw-r--r--mail/pine4-ssl/files/pgpdecode51
1 files changed, 51 insertions, 0 deletions
diff --git a/mail/pine4-ssl/files/pgpdecode b/mail/pine4-ssl/files/pgpdecode
new file mode 100644
index 000000000000..40625939c37c
--- /dev/null
+++ b/mail/pine4-ssl/files/pgpdecode
@@ -0,0 +1,51 @@
+#! /bin/sh
+# ---------- pgpdecode ---------
+# 21.03.96 Roland Rosenfeld <roland@spinnaker.rhein.de>
+#
+# Sun Mar 24 12:01:21 MET 1996 Andreas Klemm <andreas@knobel.gun.de>
+# 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
+
+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