]> git.pld-linux.org Git - packages/metamail.git/commitdiff
- renamed
authorpius <pius@pld-linux.org>
Fri, 19 Nov 1999 00:48:35 +0000 (00:48 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    metamail-arghhh.patch -> 1.1
    metamail-csh.patch -> 1.1
    metamail-fonts.patch -> 1.1
    metamail-glibc.patch -> 1.1
    metamail-ohnonotagain.patch -> 1.1
    metamail-sunquote.patch -> 1.1
    metamail-tmpfile.patch -> 1.1
    metamail-uudecode.patch -> 1.1

metamail-arghhh.patch [new file with mode: 0644]
metamail-csh.patch [new file with mode: 0644]
metamail-fonts.patch [new file with mode: 0644]
metamail-glibc.patch [new file with mode: 0644]
metamail-ohnonotagain.patch [new file with mode: 0644]
metamail-sunquote.patch [new file with mode: 0644]
metamail-tmpfile.patch [new file with mode: 0644]
metamail-uudecode.patch [new file with mode: 0644]

diff --git a/metamail-arghhh.patch b/metamail-arghhh.patch
new file mode 100644 (file)
index 0000000..c4bbcb6
--- /dev/null
@@ -0,0 +1,11 @@
+--- mm2.7/src/bin/showexternal~        Mon Jun 22 10:55:36 1998
++++ mm2.7/src/bin/showexternal Tue Jun 23 21:16:04 1998
+@@ -215,7 +215,7 @@
+           exit -1
+       endif
+       echo Subject: Automated Mail Server Request > "$NEWNAME"
+-      echo To: ${server} >> "$NEWNAME"
++      echo To: "$server" >> "$NEWNAME"
+       echo "" >> "$NEWNAME"
+       sed -e 1,/^\$/d < $bodyfile >> "$NEWNAME"
+       echo "" >> "$NEWNAME"
diff --git a/metamail-csh.patch b/metamail-csh.patch
new file mode 100644 (file)
index 0000000..a4e8a46
--- /dev/null
@@ -0,0 +1,124 @@
+--- mm2.7/src/metamail/mailto.c.cshfix Sat Oct 25 09:50:36 1997
++++ mm2.7/src/metamail/mailto.c        Sat Oct 25 09:51:03 1997
+@@ -200,9 +200,12 @@
+ }
+ TildeHelp() {
+-    char *pager = getenv("PAGER");
+     char TmpName[100], CmdBuf[150];
++    char *pager;
+     FILE *fp;
++
++    if ((pager = getenv("METAMAIL_PAGER")) == NULL)
++      pager = getenv("PAGER");
+     strcpy(TmpName, tmpname());
+     fp = fopen(TmpName, "w");
+--- mm2.7/src/bin/showexternal.cshfix  Sat Oct 25 09:45:05 1997
++++ mm2.7/src/bin/showexternal Sat Oct 25 09:46:25 1997
+@@ -19,6 +19,9 @@
+ if (! $?METAMAIL_TMPDIR) then
+     set METAMAIL_TMPDIR=/tmp
+ endif
++if (! $?METAMAIL_PAGER) then
++    set METAMAIL_PAGER=more
++endif
+ if (! $?FTP) then
+     set FTP=ftp
+ endif
+@@ -27,11 +30,19 @@
+     echo "Usage: showexternal body-file access-type name [site [directory [mode [server]]]]"
+     exit -1
+ endif
+-set bodyfile=$1
++# Check argument integrity. Don't trust mail headers
++switch ("$1$2$3$4$5$6$7")
++case "*[      ]*":
++      echo "Illegal white space in arguments -- possibly a mail bomb?!"
++      echo "Command was:"
++      echo \'$0\' \'$1\' \'$2\' \'$3\' \'$4\' \'$5\' \'$6\' \'$7\'
++      exit 2
++endsw
++set bodyfile="$1"
+ set atype=`echo $2 | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ set name=$3
+ if ($#argv > 3) then
+-    set site=$4
++    set site="$4"
+ else 
+     set site=""
+ endif
+@@ -41,12 +52,12 @@
+     set dir=""
+ endif
+ if ($#argv > 5) then
+-    set mode=$6
++    set mode="$6"
+ else
+     set mode=""
+ endif
+ if ($#argv > 6) then
+-    set server=$7
++    set server="$7"
+ else
+     set server=""
+ endif
+@@ -96,7 +107,7 @@
+ !
+       sed -e 1,/^\$/d < $bodyfile >> ${METAMAIL_TMPDIR}/ext.junk.$$
+-      more ${METAMAIL_TMPDIR}/ext.junk.$$
++      ${METAMAIL_PAGER} ${METAMAIL_TMPDIR}/ext.junk.$$
+       rm ${METAMAIL_TMPDIR}/ext.junk.$$
+       breaksw
+     default:
+--- mm2.7/src/bin/showpartial.cshfix   Sat Oct 25 09:46:37 1997
++++ mm2.7/src/bin/showpartial  Sat Oct 25 09:47:24 1997
+@@ -11,14 +11,14 @@
+     echo "Usage:  showpartial file id partnum totalnum"
+     exit -1
+ endif
+-set file=$1
++set file="$1"
+ # This next line is because message-id can contain weird chars
+ set id=`echo $2 | tr -d  \!\$\&\*\(\)\|\'\"\;\/\<\>\\` 
+ @ partnum = $3
+ if ($#argv == 3 || $4 == "") then
+     set totalnum=-1
+ else
+-    @ totalnum = $4
++    @ totalnum = "$4"
+ endif
+ if (! -d  $TREEROOT)  then
+--- mm2.7/src/bin/sun-message.csh.cshfix       Sat Oct 25 09:49:16 1997
++++ mm2.7/src/bin/sun-message.csh      Sat Oct 25 09:50:15 1997
+@@ -8,6 +8,10 @@
+ mkdir /tmp/decode.$$
+ cd /tmp/decode.$$
++if (! $?METAMAIL_PAGER) then
++    set METAMAIL_PAGER=more
++endif
++
+ if ($2 == "uuencode") then
+     uudecode $1
+@@ -37,7 +41,7 @@
+           cd /tmp; /bin/rm -rf /tmp/decode.$$
+           exit 0
+       else if ($ans == 1) then
+-          more $fn
++          ${METAMAIL_PAGER} $fn
+       else if ($ans == 2) then
+           set nfn = ""
+           echo -n "Save as: $HOME/"
+@@ -53,7 +57,7 @@
+       set defans = "3"
+     end
+ else
+-    more $1
++    ${METAMAIL_PAGER} $1
+ endif
diff --git a/metamail-fonts.patch b/metamail-fonts.patch
new file mode 100644 (file)
index 0000000..5e607ce
--- /dev/null
@@ -0,0 +1,16 @@
+--- mm2.7/src/fonts/Makefile.marc      Tue Feb 13 14:56:31 1996
++++ mm2.7/src/fonts/Makefile   Tue Feb 13 14:57:00 1996
+@@ -28,11 +28,11 @@
+       -${DIRBUILDER}
+ shownonascii: Xshownonascii
+-      sed -e s@/u/nsb/lib/fonts@`pwd`@ < Xshownonascii > shownonascii
++      sed -e s@/u/nsb/lib/fonts@/usr/lib/metamail/fonts@ < Xshownonascii > shownonascii
+       chmod +x shownonascii
+ mailto-hebrew: Xmailto-hebrew
+-      sed -e s@/u/nsb/lib/fonts@`pwd`@ < Xmailto-hebrew > mailto-hebrew
++      sed -e s@/u/nsb/lib/fonts@/usr/lib/metamail/fonts@ < Xmailto-hebrew > mailto-hebrew
+       chmod +x mailto-hebrew
+ clean:
diff --git a/metamail-glibc.patch b/metamail-glibc.patch
new file mode 100644 (file)
index 0000000..eb76c7d
--- /dev/null
@@ -0,0 +1,10 @@
+--- mm2.7/src/metamail/metamail.c.ewt  Mon Aug 26 17:16:59 1996
++++ mm2.7/src/metamail/metamail.c      Mon Aug 26 17:17:12 1996
+@@ -48,6 +48,7 @@
+ #ifndef AMIGA
+ #ifdef SYSV
+ #include <termio.h>
++#include <sys/ioctl.h>
+ #include <unistd.h>
+ #else /* SYSV */
+ #include <sgtty.h>
diff --git a/metamail-ohnonotagain.patch b/metamail-ohnonotagain.patch
new file mode 100644 (file)
index 0000000..13a75a9
--- /dev/null
@@ -0,0 +1,1794 @@
+diff -d -r -u -P mm2.7.orig/src/bin/audiocompose mm2.7/src/bin/audiocompose
+--- mm2.7.orig/src/bin/audiocompose    Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/audiocompose Sat Jun 20 14:41:16 1998
+@@ -28,8 +28,8 @@
+     set dev=/dev/audio
+ endif
+-set audiofile=$1
+-if (-e $audiofile && ! -z $audiofile) goto whatnext
++set audiofile="$1"
++if (-e "$audiofile" && ! -z "$audiofile") goto whatnext
+ record:
+ echo -n "Press RETURN when you are ready to start recording: "
+@@ -38,13 +38,22 @@
+ # THIS IS UNBELIEVABLY GRUBBY
+ onintr cleanup
+ if (! $?RECORD_AUDIO) then
+-    (/bin/cat < $dev > $audiofile) &
++    (/bin/cat < $dev > "$audiofile") &
+ else
+-    ($RECORD_AUDIO > $audiofile) &
++    ($RECORD_AUDIO > "$audiofile") &
+ endif
+-jobs -l > ${METAMAIL_TMPDIR}/AUDCAT.$$
+-set foo=`/bin/cat ${METAMAIL_TMPDIR}/AUDCAT.$$`
+-/bin/rm ${METAMAIL_TMPDIR}/AUDCAT.$$
++#  Generate temporary file name:
++if ( -x /bin/mktemp ) then
++    set TmpAudCat=`/bin/mktemp ${METAMAIL_TMPDIR}/AUDCAT.XXXXXXX` || exit 1
++else if ( -x /usr/bin/mktemp ) then
++    set TmpAudCat=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/AUDCAT.XXXXXXX` || exit 1
++else
++    set TmpAudCat=${METAMAIL_TMPDIR}/AUDCAT.$$
++    rm -rf $TmpAudCat
++endif
++jobs -l > $TmpAudCat
++set foo=`/bin/cat $TmpAudCat`
++/bin/rm $TmpAudCat
+ set PID=$foo[2]
+ echo -n "press RETURN when you are done recording: "
+ set foo=$<
+@@ -63,7 +72,7 @@
+ set which = $<
+     switch ("$which")
+         case 1:
+-          cat $audiofile > $dev
++          cat "$audiofile" > $dev
+           breaksw
+         case 2:
+           goto record
+diff -d -r -u -P mm2.7.orig/src/bin/audiosend mm2.7/src/bin/audiosend
+--- mm2.7.orig/src/bin/audiosend       Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/audiosend    Sat Jun 20 14:42:48 1998
+@@ -29,7 +29,7 @@
+ endif
+ if ( $#argv == 1 ) then
+-    set to = $1
++    set to = "$1"
+ else
+     echo -n "To: "
+     set to = $<
+@@ -43,8 +43,23 @@
+ echo -n "Press RETURN when you are ready to start recording: "
+ set foo = $<
+-set fname = ${METAMAIL_TMPDIR}/audio-out.$$
+-set fnameraw = ${METAMAIL_TMPDIR}/audio-raw.$$
++#  Generate work file names:
++if ( -x /bin/mktemp ) then
++    set fname=`/bin/mktemp ${METAMAIL_TMPDIR}/audio-out.XXXXXXX` || exit 1
++else if ( -x /usr/bin/mktemp ) then
++    set fname=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/audio-out.XXXXXXX` || exit 1
++else
++    set fname = ${METAMAIL_TMPDIR}/audio-out.$$
++    rm -rf $fname
++endif
++if ( -x /bin/mktemp ) then
++    set fnameraw=`/bin/mktemp ${METAMAIL_TMPDIR}/audio-raw.XXXXXXX` || exit 1
++else if ( -x /usr/bin/mktemp ) then
++    set fnameraw=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/audio-raw.XXXXXXX` || exit 1
++else
++    set fnameraw = ${METAMAIL_TMPDIR}/audio-raw.$$
++    rm -rf $fnameraw
++endif
+ echo "To: " "$to" > $fname
+ echo "Subject: " "$subject" >> $fname
+@@ -60,9 +75,18 @@
+ else
+     ($RECORD_AUDIO > $fnameraw) &
+ endif
+-jobs -l > ${METAMAIL_TMPDIR}/AUDCAT.$$
+-set foo=`/bin/cat ${METAMAIL_TMPDIR}/AUDCAT.$$`
+-/bin/rm ${METAMAIL_TMPDIR}/AUDCAT.$$
++#  Generate temporary file name:
++if ( -x /bin/mktemp ) then
++    set TmpAudCat=`/bin/mktemp ${METAMAIL_TMPDIR}/AUDCAT.XXXXXXX` || exit 1
++else if ( -x /usr/bin/mktemp ) then
++    set TmpAudCat=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/AUDCAT.XXXXXXX` || exit 1
++else
++    set TmpAudCat=${METAMAIL_TMPDIR}/AUDCAT.$$
++    rm -rf $TmpAudCat
++endif
++jobs -l > $TmpAudCat
++set foo=`/bin/cat $TmpAudCat`
++/bin/rm $TmpAudCat
+ set PID=$foo[2]
+ echo -n "press RETURN when you are done recording: "
+ set foo=$<
+@@ -86,7 +110,7 @@
+     switch ("$which")
+         case 1:
+           echo -n "Sending mail, please wait...  "
+-          /usr/lib/sendmail $to  $cc < $fname
++          /usr/lib/sendmail "$to" "$cc" < $fname
+           if (! $status) then
+             echo "Done."
+             rm $fname
+diff -d -r -u -P mm2.7.orig/src/bin/extcompose mm2.7/src/bin/extcompose
+--- mm2.7.orig/src/bin/extcompose      Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/extcompose   Sat Jun 20 14:47:19 1998
+@@ -6,7 +6,7 @@
+     echo "Usage:  extcompose output-file-name"
+     exit 1
+ endif
+-set OUTFNAME=$1
++set OUTFNAME="$1"
+ chooseaccesstype:
+ echo ""
+@@ -19,21 +19,21 @@
+ echo ""
+ echo -n "Please enter a number from 1 to 5: "
+ set ans=$<
+-if ($ans == 1)  then
++if ("$ans" == 1)  then
+     set accesstype=local-file
+-else if ($ans == 2) then
++else if ("$ans" == 2) then
+     set accesstype=afs
+-else if ($ans == 3) then
++else if ("$ans" == 3) then
+     set accesstype=anon-ftp
+-else if ($ans == 4) then
++else if ("$ans" == 4) then
+     set accesstype=ftp
+-else if ($ans == 5) then
++else if ("$ans" == 5) then
+     set accesstype=mail-server
+ else
+     echo "That is NOT one of your choices."
+     goto chooseaccesstype
+ endif
+-if ($accesstype == "ftp" || $accesstype == "anon-ftp") then
++if ("$accesstype" == "ftp" || "$accesstype" == "anon-ftp") then
+     echo -n "Enter the full Internet domain name of the FTP site: "
+     set site=$<
+     echo -n "Enter the name of the directory containing the file (RETURN for top-level): "
+@@ -42,27 +42,27 @@
+     set name = $<
+     echo -n "Enter the transfer mode (type 'image' for binary data, RETURN otherwise): "
+     set mode = $<
+-    if ($mode == "") set mode=ascii
+-    echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"\; > $OUTFNAME
+-    echo -n "    site="\"$site\" >> $OUTFNAME
+-    if ($directory != "") echo -n "; directory="\"$directory\">> $OUTFNAME
+-    if ($mode != "") echo -n "; mode="\"$mode\">> $OUTFNAME
+-    echo "">> $OUTFNAME
+-else if ($accesstype == "local-file" || $accesstype == "afs") then
++    if ("$mode" == "") set mode=ascii
++    echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"\; > "$OUTFNAME"
++    echo -n "    site="\"$site\" >> "$OUTFNAME"
++    if ("$directory" != "") echo -n "; directory="\"$directory\">> "$OUTFNAME"
++    if ("$mode" != "") echo -n "; mode="\"$mode\">> "$OUTFNAME"
++    echo "">> "$OUTFNAME"
++else if ("$accesstype" == "local-file" || "$accesstype" == "afs") then
+ fname:
+     echo -n "Enter the full path name for the file: "
+     set name = $<
+-    if (! -e $name) then
++    if (! -e "$name") then
+       echo "The file $name does not seem to exist."
+       goto fname
+     endif
+-    echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"> $OUTFNAME
+-else if ($accesstype == "mail-server") then
++    echo "Content-type: message/external-body; access-type=$accesstype; name="\"$name\"> "$OUTFNAME"
++else if ("$accesstype" == "mail-server") then
+     echo -n "Enter the full email address for the mailserver: "
+     set server=$<
+-    echo "Content-type: message/external-body; access-type=$accesstype; server="\"$server\"> $OUTFNAME
++    echo "Content-type: message/external-body; access-type=$accesstype; server="\"$server\"> "$OUTFNAME"
+ else
+-    echo accesstype $accesstype not yet implemented
++    echo accesstype "$accesstype" not yet implemented
+     goto chooseaccesstype
+ endif
+@@ -92,12 +92,12 @@
+         echo "That is not one of your choices."
+         goto getcenc
+ endsw
+-echo "" >> $OUTFNAME
+-echo "Content-type: " $ctype >> $OUTFNAME
+-if ($cenc != "") echo "Content-transfer-encoding: " $cenc >> $OUTFNAME
+-echo "" >> $OUTFNAME
+-if ($accesstype == "mail-server") then
++echo "" >> "$OUTFNAME"
++echo "Content-type: " "$ctype" >> "$OUTFNAME"
++if ("$cenc" != "") echo "Content-transfer-encoding: " "$cenc" >> "$OUTFNAME"
++echo "" >> "$OUTFNAME"
++if ("$accesstype" == "mail-server") then
+     echo "Please enter all the data to be sent to the mailserver in the message body, "
+     echo "ending with ^D or your usual end-of-data character:"
+-    cat >> $OUTFNAME
++    cat >> "$OUTFNAME"
+ endif
+diff -d -r -u -P mm2.7.orig/src/bin/getfilename mm2.7/src/bin/getfilename
+--- mm2.7.orig/src/bin/getfilename     Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/getfilename  Sat Jun 20 14:47:43 1998
+@@ -8,9 +8,9 @@
+     echo Aborted
+     exit -1
+ endif
+-if (! -r  $fnam) then
++if (! -r "$fnam") then
+     echo No such file
+     exit -1
+ endif
+-cp $fnam $2
++cp "$fnam" "$2"
+ exit 0
+diff -d -r -u -P mm2.7.orig/src/bin/mailserver mm2.7/src/bin/mailserver
+--- mm2.7.orig/src/bin/mailserver      Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/mailserver   Sat Jun 20 23:01:33 1998
+@@ -28,20 +28,28 @@
+ rehash
+ set FromName=""
+ set Subject=""
+-set TmpFile=/tmp/ms.$$
++#  Generate temporary file name:
++if ( -x /bin/mktemp ) then
++    set TmpFile=`/bin/mktemp /tmp/ms.XXXXXXX` || exit 1
++else if ( -x /usr/bin/mktemp ) then
++    set TmpFile=`/usr/bin/mktemp /tmp/ms.XXXXXXX` || exit 1
++else
++    set TmpFile=/tmp/ms.$$
++    rm -rf $TmpFile
++endif
+ set FOORAW=$<
+ while ("$FOORAW" != "") 
+ set FOO=(` echo "$FOORAW" | tr "[" "x"`)
+ set BAR=($FOO)
+-set BARLC=(`echo $FOO | tr A-Z a-z`)
+-if ($BARLC[1] == "from:") then
++set BARLC=(`echo "$FOO" | tr A-Z a-z`)
++if ("$BARLC[1]" == "from:") then
+       if ("$FromName" == "") then
+-              set FromName = ($BAR[2-])
++              set FromName = ("$BAR[2-]")
+       endif
+ else if ($BARLC[1] == "reply-to:") then
+-      set FromName = ($BAR[2-])
++      set FromName = ("$BAR[2-]")
+ else if ($BARLC[1] == "subject:") then
+-      set Subject = ($BAR[2-])
++      set Subject = ("$BAR[2-]")
+ endif
+ set FOORAW=$<
+ end
+@@ -52,10 +60,10 @@
+ endif
+ if ("$FromName" == "") then
+-      cat > $TmpFile <<!
+-From: $LOCALADDR@`hostname`
+-To: $MAINTAINER
+-Subject: $Subject
++      echo From: "$LOCALADDR"@`hostname` > $TmpFile
++      echo To: "$MAINTAINER" >> $TmpFile
++      echo Subject: "$Subject" >> $TmpFile
++      cat >> $TmpFile <<!
+ The metamail mailserver script, installed locally as $LOCALADDR, \rhas received a request without any reply address.
+@@ -68,18 +76,18 @@
+ probably run in some circumstance other than mail delivery.
+ --------------------
+ !
+-      cat $TmpFile - | /usr/lib/sendmail $MAINTAINER
++      cat $TmpFile - | /usr/lib/sendmail "$MAINTAINER"
+       # Takes the rest of the message from standard input
+       rm $TmpFile
+       exit 0
+ endif
+-set danger=`echo $Subject | fgrep ..`
+-if ($danger != "") then
+-      cat > $TmpFile <<!
+-From: $LOCALADDR@`hostname`
+-To: $FromName
+-Subject: Re: $Subject
++set danger=`echo "$Subject" | fgrep ..`
++if ("$danger" != "") then
++      echo From: "$LOCALADDR"@`hostname` > $TmpFile
++      echo To: "$FromName" >> $TmpFile
++      echo Subject: Re: "$Subject" >> $TmpFile
++      cat >> $TmpFile <<!
+ For security reasons, this mailserver automatically rejects all requests 
+ that contain ".." in the path name.
+@@ -93,60 +101,64 @@
+ cd $ROOTDIR
+ if (! -e "$Subject") then
+-      cat > $TmpFile <<!
+-From: $LOCALADDR@`hostname`
+-To: $FromName
+-Subject: Re: $Subject
+-
+-You recently sent mail to this mail-server requesting the file: 
+-      $Subject
+-
+-That file does not exist, so your request could not be met.
+-
+-Here is a list of the currently available files:
+---------------------------------
+-!
++      #  We use a bunch of echo statements rather than a here-document
++      #  so that we can be sure to quote all of our variables properly.
++      echo From: "$LOCALADDR"@`hostname` > $TmpFile
++      echo To: "$FromName" >> $TmpFile
++      echo Subject: Re: "$Subject" >> $TmpFile
++      echo "" >> $TmpFile
++      echo "You recently sent mail to this mail-server requesting the file:" >> $TmpFile
++      echo "  $Subject" >> $TmpFile
++      echo "" >> $TmpFile
++      echo "That file does not exist, so your request could not be met." >> $TmpFile
++      echo "" >> $TmpFile
++      echo "Here is a list of the currently available files:" >> $TmpFile
++      echo "--------------------------------" >> $TmpFile
+       ls -R >> $TmpFile
++      echo "" >> $TmpFile
+       /usr/lib/sendmail -t < $TmpFile
+       rm $TmpFile
+       exit 0
+ endif
+-if (-e ${Subject}.ct) then
+-      set ct=`cat ${Subject}.ct`
++if (-e "${Subject}.ct") then
++      set ct=`cat "${Subject}.ct"`
+ else 
+       set ct="application/octet-stream"
+ endif
+ metasend -b -t "$FromName" -f "$Subject" -m "$ct" -s "Re: $Subject"
+ if ($status != 0) then
+-      cat > $TmpFile <<!
+-From: $LOCALADDR@`hostname`
+-To: $FromName
+-Subject: Re: $Subject
+-
+-You recently sent mail to this mail-server requestion the file: 
+-      $Subject
+-
+-An unanticipated error apparently precluded delivery of the file.
+-Please accept our apologies.
+-
+-Command failed: 
+-  metasend -b -t "$FromName" -f "$Subject" -m "$ct" -s "Re: $Subject"
+-
+-!
++      #  We use a bunch of echo statements rather than a here-document
++      #  so that we can be sure to quote all of our variables properly.
++      echo From: "$LOCALADDR"@`hostname` > $TmpFile
++      echo To: "$FromName" >> $TmpFile
++      echo Subject: Re: "$Subject" >> $TmpFile
++      echo "" >> $TmpFile
++      echo "You recently sent mail to this mail-server requestion the file:" >> $TmpFile
++      echo "  $Subject" >> $TmpFile
++      echo "" >> $TmpFile
++      echo "An unanticipated error apparently precluded delivery of the file." >> $TmpFile
++      echo "Please accept our apologies." >> $TmpFile
++      echo "" >> $TmpFile
++      echo "Command failed:" >> $TmpFile
++      echo "  metasend -b -t $FromName -f $Subject -m $ct -s Re: $Subject" >> $TmpFile
++      echo "" >> $TmpFile
+       /usr/lib/sendmail -t < $TmpFile
+       rm $TmpFile
+       exit 0
+ endif
+ if ("$LOGADDR" != "") then
+-      /usr/lib/sendmail -t <<!
+-From: ${LOCALADDR}@`hostname`
+-To: $LOGADDR
+-Subject: Autosend delivery report
++      echo From: "${LOCALADDR}"@`hostname` > $TmpFile
++      echo To: "$LOGADDR" >> $TmpFile
++      echo Subject: Autosend delivery report >> $TmpFile
++      echo "" >> $TmpFile
++      echo The file: "$Subject" >> $TmpFile
++      echo was sent to: "$FromName" >> $TmpFile
++      echo "" >> $TmpFile
++      /usr/lib/sendmail -t < $TmpFile
++endif
+-The file: $Subject 
+-was sent to: $FromName
+-!
++rm -f $TmpFile
+ exit 0
+diff -d -r -u -P mm2.7.orig/src/bin/metasend mm2.7/src/bin/metasend
+--- mm2.7.orig/src/bin/metasend        Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/metasend     Sat Jun 20 14:59:30 1998
+@@ -45,7 +45,7 @@
+                 echo "-S requires a following argument, the SPLIT threshhold"
+                 exit -1
+             endif
+-            set splitsize=$1
++            set splitsize="$1"
+             shift
+             breaksw
+         case "-b":
+@@ -68,7 +68,7 @@
+                 echo "-i requires a following argument, the Content-ID value"
+                 exit -1
+             endif
+-            set cid=$1
++            set cid="$1"
+             shift
+             breaksw
+         case "-I":
+@@ -77,7 +77,7 @@
+                 echo "-I requires a following argument, the multipart Content-ID value"
+                 exit -1
+             endif
+-            set multicid=$1
++            set multicid="$1"
+             shift
+             breaksw
+         case "-s":
+@@ -122,12 +122,12 @@
+                 echo "-e requires a following argument, the ENCODING value"
+                 exit -1
+             endif
+-            set encode=$1
+-            if ($encode == "base64") then
++            set encode="$1"
++            if ("$encode" == "base64") then
+           set encodingprog = "mimencode -b"
+-            else if ($encode == "x-uue") then
++            else if ("$encode" == "x-uue") then
+               set encodingprog = "uuencode mail-body"
+-            else if ($encode == "7bit") then
++            else if ("$encode" == "7bit") then
+               set encodingprog = cat
+            else
+               set encodingprog = "mimencode -q"
+@@ -141,9 +141,9 @@
+                 echo "-f requires a following argument, the DATA FILE"
+                 exit -1
+             endif
+-            set datafile=$1
+-            if (! -e  $datafile) then
+-                echo The file $datafile does not exist.
++            set datafile="$1"
++            if (! -e "$datafile") then
++                echo The file "$datafile" does not exist.
+                 exit -1
+             endif
+             shift
+@@ -154,10 +154,10 @@
+                 echo "-m requires a following argument, the MIME CONTENT-TYPE"
+                 exit -1
+             endif
+-#            set ctyperaw = $1
+-#            set  ctype=`echo $ctyperaw | tr \" \'`
++#            set ctyperaw = "$1"
++#            set  ctype=`echo "$ctyperaw" | tr \" \'`
+       set ctype = "$1"
+-      if (`echo $ctype | grep /` == "") then
++      if (`echo "$ctype" | grep /` == "") then
+           echo "Invalid content-type specified"
+           exit -1
+       endif
+@@ -228,11 +228,11 @@
+               endif
+       endif
+       set ctype${multipart} = "$ctype"
+-      set datafile${multipart} = $datafile
+-      set encode${multipart} = $encode
++      set datafile${multipart} = "$datafile"
++      set encode${multipart} = "$encode"
+       set cdescrip${multipart} = "$cdescrip"
+       set cid${multipart} = "$cid"
+-      set isentity${multipart} = $isentity
++      set isentity${multipart} = "$isentity"
+       set encodingprog${multipart} = "$encodingprog"
+       unset ctype
+       unset datafile
+@@ -247,11 +247,11 @@
+       shift
+       breaksw
+         default:
+-            echo UNRECOGNIZED METASEND OPTION: $1
++            echo UNRECOGNIZED METASEND OPTION: "$1"
+             exit -1
+     endsw
+ end
+-if ($batchmode == 0) then
++if ("$batchmode" == 0) then
+     if (! $?to) then
+         echo -n "To: "
+         set to = $<
+@@ -271,18 +271,18 @@
+ #        set  ctype=`echo $ctyperaw | tr \" \'`
+         set ctype = "$<"
+     endif
+-    if (`echo $ctype | grep /` == "") then
++    if (`echo "$ctype" | grep /` == "") then
+         echo "Invalid content-type specified"
+         unset ctype
+         goto anotherpart
+     endif
+-#    if ($ctype != $ctyperaw)  echo Double  quotes not allowed, using $ctype
++#    if ("$ctype" != "$ctyperaw") echo Double quotes not allowed, using "$ctype"
+     if (! $?datafile) then
+         getfile:
+         echo -n "Name of file containing $ctype data: "
+         set datafile = $<
+-        if (! -e  $datafile) then
+-            echo The file $datafile does not exist.
++        if (! -e "$datafile") then
++            echo The file "$datafile" does not exist.
+             goto getfile
+         endif
+     endif
+@@ -320,12 +320,12 @@
+     set ans=$<
+     if  ("$ans" =~ y*) then
+       set ctype${multipart} = "$ctype"
+-      set datafile${multipart} = $datafile
+-      set encode${multipart} = $encode
++      set datafile${multipart} = "$datafile"
++      set encode${multipart} = "$encode"
+       set encodingprog${multipart} = "$encodingprog"
+       set cdescrip${multipart} = "$cdescrip"
+       set cid${multipart} = "$cid"
+-      set isentity${multipart} = $isentity
++      set isentity${multipart} = "$isentity"
+       set cdescrip = "An object packed by metasend"
+       set isentity=0
+       unset ctype
+@@ -339,7 +339,7 @@
+             goto anotherpart
+      endif
+ else
+-    if ($outputfile == "") then
++    if ("$outputfile" == "") then
+       if (! $?to || ! $?subject || ! $?ctype || ! $?datafile) then
+         echo metasend: in batch mode, if output is not directed to a file,-t, -s, -f, and -m are all required
+         exit -1
+@@ -359,12 +359,12 @@
+         exit -1
+       endif
+     endif    
+-    if (! -e  $datafile) then
+-        echo metasend:  The file $datafile does not exist
++    if (! -e "$datafile") then
++        echo metasend:  The file "$datafile" does not exist
+         exit -1
+     endif
+ #    if (! $?cc) set cc=""
+-#     if ($ctype != $ctyperaw)  echo Double  quotes not allowed, using $ctype
++#    if ("$ctype" != "$ctyperaw") echo Double quotes not allowed, using "$ctype"
+     if (! $?encode) then
+         if ("$ctype" =~ text*) then
+       set encodingprog = "mimencode -q"
+@@ -373,11 +373,11 @@
+             set encodingprog = "mimencode -b"
+             set encode = base64
+         endif
+-    else if ($encode == "base64") then
++    else if ("$encode" == "base64") then
+         set encodingprog = "mimencode -b"
+-    else if ($encode == "x-uue") then
++    else if ("$encode" == "x-uue") then
+         set encodingprog = "uuencode mail-body"
+-    else if ($encode == "7bit") then
++    else if ("$encode" == "7bit") then
+         set encodingprog = cat
+     else
+         set encodingprog = "mimencode -q"
+@@ -395,14 +395,22 @@
+         endif
+ endif
+ set ctype${multipart} = "$ctype"
+-set datafile${multipart} = $datafile
+-set encode${multipart} = $encode
++set datafile${multipart} = "$datafile"
++set encode${multipart} = "$encode"
+ set cdescrip${multipart} = "$cdescrip"
+ set cid${multipart} = "$cid"
+-set isentity${multipart} = $isentity
++set isentity${multipart} = "$isentity"
+ set encodingprog${multipart} = "$encodingprog"
+-set fname = ${METAMAIL_TMPDIR}/metasend.$$
++#  Generate file name:
++if ( -x /bin/mktemp ) then
++    set fname=`/bin/mktemp ${METAMAIL_TMPDIR}/metasend.XXXXXXX` || exit 1
++else if ( -x /usr/bin/mktemp ) then
++    set fname=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/metasend.XXXXXXX` || exit 1
++else
++    set fname=${METAMAIL_TMPDIR}/metasend.$$
++    rm -rf $fname
++endif
+ echo "MIME-Version: 1.0" > $fname
+ if ($?to) then
+     echo "To: " "$to" >> $fname
+@@ -429,17 +437,26 @@
+     echo "    boundary="\"$boundary\" >> $fname
+     echo "" >> $fname
+     if ($?preamblefile) then
+-        cat $preamblefile >> $fname
++        cat "$preamblefile" >> $fname
+     else
+         echo "This is  a multimedia message in MIME  format.  If you are reading this" >> $fname
+         echo "prefix, your mail reader does  not understand MIME.  You may wish" >> $fname
+         echo "to look into upgrading to a newer version of  your mail reader." >> $fname
+     endif
+     set i=1
+-    set junkfile=${METAMAIL_TMPDIR}/mmjunk.$$
+-    while  ($multipart >= $i)
++
++    #  Generate temporary file name:
++    if ( -x /bin/mktemp ) then
++        set junkfile=`/bin/mktemp ${METAMAIL_TMPDIR}/mmjunk.XXXXXXX` || exit 1
++    else if ( -x /usr/bin/mktemp ) then
++        set junkfile=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/mmjunk.XXXXXXX` || exit 1
++    else
++        set junkfile=${METAMAIL_TMPDIR}/mmjunk.$$
++        rm -rf $junkfile
++    endif
++    while  ("$multipart" >= $i)
+       echo "" >> $fname
+-      echo --$boundary >> $fname
++      echo --"$boundary" >> $fname
+       echo set isentity=\$isentity$i > $junkfile
+       source $junkfile
+       if (! $isentity) then
+@@ -463,27 +480,27 @@
+     end
+     rm $junkfile
+     echo "" >> $fname
+-    echo --${boundary}-- >> $fname
++    echo --"${boundary}"-- >> $fname
+     echo "" >> $fname
+ else 
+     if (! $isentity) then
+         echo "Content-ID: $cid"   >> $fname
+-        echo "Content-type: " $ctype >> $fname
+-        echo "Content-Description: " $cdescrip >> $fname
+-        echo "Content-Transfer-Encoding: " $encode >> $fname
++        echo "Content-type: " "$ctype" >> $fname
++        echo "Content-Description: " "$cdescrip" >> $fname
++        echo "Content-Transfer-Encoding: " "$encode" >> $fname
+     endif
+     echo  "" >> $fname
+-    $encodingprog < $datafile >> $fname
++    $encodingprog < "$datafile" >> $fname
+     # Ensure last line has trailing carriage return
+     echo "" >> $fname
+ endif
+-if ($outputfile == "") then
+-    if ($batchmode == 0) echo -n "Delivering mail, please wait...  "
+-    splitmail -s $splitsize -d $fname
++if ("$outputfile" == "") then
++    if ("$batchmode" == 0) echo -n "Delivering mail, please wait...  "
++    splitmail -s "$splitsize" -d "$fname"
+     if (! $status) then
+-        if ($batchmode == 0) echo "Mail delivery apparently succeeded."
++        if ("$batchmode" == 0) echo "Mail delivery apparently succeeded."
+         rm $fname
+-    else if ($MustDelete == 1) then
++    else if ("$MustDelete" == 1) then
+         echo Mail delivery failed
+         rm $fname
+         exit -1
+@@ -492,7 +509,7 @@
+         exit -1
+     endif
+ else
+-    mv $fname $outputfile
++    mv $fname "$outputfile"
+     if ($status) exit -1
+ endif
+ exit 0
+diff -d -r -u -P mm2.7.orig/src/bin/patch-metamail mm2.7/src/bin/patch-metamail
+--- mm2.7.orig/src/bin/patch-metamail  Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/patch-metamail       Sat Jun 20 23:18:20 1998
+@@ -5,40 +5,53 @@
+ set DIRNAME=pub/nsb
+ set PREFIX="mm.patch."
++if (! $?METAMAIL_TMPDIR) then
++    set METAMAIL_TMPDIR=/tmp
++endif
++
+ if ($#argv < 2 || $#argv > 5) then
+       echo Usage:  patch-metamail source-tree-root patch-number [hostname [dirname [prefix]]]
+       exit -1
+ endif
+-set TREEROOT=$1
+-set PATCHNUMBER=$2
+-if ($#argv > 2) set HOSTNAME=$3
+-if ($#argv > 3) set DIRNAME=$4
+-if ($#argv > 4) set PREFIX=$5
++set TREEROOT="$1"
++set PATCHNUMBER="$2"
++if ($#argv > 2) set HOSTNAME="$3"
++if ($#argv > 3) set DIRNAME="$4"
++if ($#argv > 4) set PREFIX="$5"
+       
+ echo WARNING:  This program, if allowed to do so, will attempt to 
+ echo install a PATCH file for your metamail sources which are rooted 
+-echo in the directory $TREEROOT.
++echo in the directory "$TREEROOT".
+ echo ""
+ echo It will use a patch file that it retrieves via anonymous ftp
+-echo from the host $HOSTNAME, in the directory $DIRNAME, 
+-echo with filenames starting with ${PREFIX}.
++echo from the host "$HOSTNAME", in the directory "$DIRNAME", 
++echo with filenames starting with "${PREFIX}".
+ echo ""
+ echo -n "Do you want to install the patch in directory $TREEROOT [y/n] ? "
+ set ans=$<
+-if ($ans == "y" || $ans == "Y") then
+-    cd $TREEROOT
++if ("$ans" == "y" || "$ans" == "Y") then
++    cd "$TREEROOT"
+     set ident=`whoami`@`hostname`
+-    echo Using anonymous ftp with password $ident
+-    ftp -n <<!
+-open $HOSTNAME
+-user anonymous $ident
+-cd $DIRNAME
+-binary
+-get ${PREFIX}${PATCHNUMBER}
+-quit
+-!
+-    patch -p < ${PREFIX}${PATCHNUMBER}
++    #  Generate temporary file name:
++    if ( -x /bin/mktemp ) then
++        set TmpFtp=`/bin/mktemp ${METAMAIL_TMPDIR}/mm.ftp.XXXXXXX` || exit 1
++    else if ( -x /usr/bin/mktemp ) then
++        set TmpFtp=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/mm.ftp.XXXXXXX` || exit 1
++    else
++        set TmpFtp=${METAMAIL_TMPDIR}/mm.ftp.$$
++        rm -rf $TmpFtp
++    endif
++    echo open "$HOSTNAME" > $TmpFtp
++    echo user anonymous "$ident" >> $TmpFtp
++    echo cd "$DIRNAME" >> $TmpFtp
++    echo binary >> $TmpFtp
++    echo get "${PREFIX}${PATCHNUMBER}" >> $TmpFtp
++    echo quit >> $TmpFtp
++    echo Using anonymous ftp with password "$ident"
++    ftp -n < $TmpFtp
++    rm -f $TmpFtp
++    patch -p < "${PREFIX}${PATCHNUMBER}"
+ else
+       echo Patch not installed
+ endif
+diff -d -r -u -P mm2.7.orig/src/bin/rcvAppleSingle mm2.7/src/bin/rcvAppleSingle
+--- mm2.7.orig/src/bin/rcvAppleSingle  Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/rcvAppleSingle       Sat Jun 20 14:08:30 1998
+@@ -13,7 +13,7 @@
+ # Written by Patrik Faltstrom, paf@nada.kth.se, may 1993
+ #
+-FILENAME=$1
++FILENAME="$1"
+ #
+ # If $AFPDIR environment variable is set, all Macintosh filenames
+@@ -31,12 +31,12 @@
+    exit 1
+ fi
+-echo $NAME | grep '^/' > /dev/null
++echo "$NAME" | grep '^/' > /dev/null
+ if [ $? = 1 ]; then
+-  NAME=$AFPDIR/$NAME
++  NAME="$AFPDIR/$NAME"
+ fi
+-cvt2cap $FILENAME $NAME
++cvt2cap "$FILENAME" "$NAME"
+ echo "Saved AppleMacintosh file as $NAME"
+ exit 0
+diff -d -r -u -P mm2.7.orig/src/bin/showaudio mm2.7/src/bin/showaudio
+--- mm2.7.orig/src/bin/showaudio       Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/showaudio    Sat Jun 20 15:01:55 1998
+@@ -33,7 +33,7 @@
+ set ORG="Bellcore"
+ set STDINPUT=0
+ if ("$1" == "-p") then
+-    set AUDIOPHONE=$2
++    set AUDIOPHONE="$2"
+     shift
+     shift
+ endif
+@@ -73,13 +73,13 @@
+     echo ""
+     echo -n "Which do you prefer (1 or 2)? "
+     set ans=$<
+-    if ($ans == 2)  then
++    if ("$ans" == 2)  then
+       echo "OK, we'll use the telephone..."
+       set AUDIOPHONEFORCE=1
+       echo "In the future, you can avoid this question by setting the environment variable"
+       echo "AUDIOPHONEFORCE to 1"
+       goto playphone
+-    else if ($ans == 1) then
++    else if ("$ans" == 1) then
+       echo "OK, Attempting to play the audio using your computer's speaker.."
+       set AUDIOSPEAKERFORCE=1
+       echo "In the future, you can avoid this question by setting the environment variable"
+@@ -93,8 +93,8 @@
+ set audiohost=$thishost
+ if ($?DISPLAY) then
+     set audiohost=`echo $DISPLAY | sed -e 's/:.*//'`
+-    if ($audiohost == "unix") set audiohost=$thishost
+-    if ($audiohost == "") set audiohost=$thishost
++    if ("$audiohost" == "unix") set audiohost=$thishost
++    if ("$audiohost" == "") set audiohost=$thishost
+ endif
+ if ($?AUDIOHOST) then
+       set audiohost=$AUDIOHOST
+@@ -127,9 +127,18 @@
+     if ($#argv >= 1) then
+       exec /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $*
+     else
+-      cat > ${METAMAIL_TMPDIR}/audio.$$
+-      /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end ${METAMAIL_TMPDIR}/audio.$$
+-      rm ${METAMAIL_TMPDIR}/audio.$$
++      # Generate temporary file name:
++      if ( -x /bin/mktemp ) then
++          set TmpAudio=`/bin/mktemp ${METAMAIL_TMPDIR}/audio.XXXXXXX` || exit 1
++      else if ( -x /usr/bin/mktemp ) then
++          set TmpAudio=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/audio.XXXXXXX` || exit 1
++      else
++          set TmpAudio=${METAMAIL_TMPDIR}/audio.$$
++          rm -rf $TmpAudio
++      endif
++      cat > $TmpAudio
++      /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $TmpAudio
++      rm $TmpAudio
+       exit 0
+     endif
+ else if (-d /usr/sony) then
+@@ -198,7 +207,15 @@
+ echo ""
+ if (! $?MM_NOTTTY) set MM_NOTTTY=0
+ if ($MM_NOTTTY == 1) then
+-    set fname=/tmp/mm.aud.$$
++    # Generate unique file name:
++    if ( -x /bin/mktemp ) then
++        set fname=`/bin/mktemp /tmp/mm.aud.XXXXXXX` || exit 1
++    else if ( -x /usr/bin/mktemp ) then
++        set fname=`/usr/bin/mktemp /tmp/mm.aud.XXXXXXX` || exit 1
++    else
++        set fname=/tmp/mm.aud.$$
++        rm -rf $fname
++    endif
+ else
+     echo -n "Do you want to write the audio out to a file [y] ? "
+     set ANS=$<
+@@ -206,7 +223,7 @@
+     echo -n "File name:"
+     set fname=$<
+ endif
+-cp $1 $fname
+-if ($status == 0) echo Wrote raw audio file: $fname
++cp "$1" "$fname"
++if ($status == 0) echo Wrote raw audio file: "$fname"
+ exit 0
+diff -d -r -u -P mm2.7.orig/src/bin/showexternal mm2.7/src/bin/showexternal
+--- mm2.7.orig/src/bin/showexternal    Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/showexternal Sat Jun 20 23:20:49 1998
+@@ -40,14 +40,14 @@
+ endsw
+ set bodyfile="$1"
+ set atype=`echo $2 | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+-set name=$3
++set name="$3"
+ if ($#argv > 3) then
+     set site="$4"
+ else 
+     set site=""
+ endif
+ if ($#argv > 4) then
+-    set dir=$5
++    set dir="$5"
+ else
+     set dir=""
+ endif
+@@ -62,10 +62,10 @@
+     set server=""
+ endif
+-if ("$server" == "" && $atype == "mail-server") then
++if ("$server" == "" && "$atype" == "mail-server") then
+ # Backward compatibility with some broken stuff
+-    set server=${name}@${site}
+-    echo WARNING -- old style mailserver syntax, using server $server
++    set server="${name}@${site}"
++    echo WARNING -- old style mailserver syntax, using server "$server"
+ endif
+ set ctype="`grep -i content-type: $bodyfile | sed -e 's/............: //'`"
+@@ -75,6 +75,10 @@
+ set pass=""
+ set TMPDIR=${METAMAIL_TMPDIR}/XXXternal.$$
+ mkdir $TMPDIR
++if ( $status != 0 ) then
++    echo Error creating temporary directory
++    exit 1
++endif
+ pushd $TMPDIR
+ set NEWNAME="mm.ext.$$"
+ set NEEDSCONFIRMATION=1
+@@ -90,7 +94,16 @@
+       echo automatically using  the FTP protocol to a site on the network.
+       breaksw
+     case mail-server:  
+-      cat > ${METAMAIL_TMPDIR}/ext.junk.$$ <<!
++      #  Generate temporary file name:
++      if ( -x /bin/mktemp ) then
++          set TmpExtJunk=`/bin/mktemp ${METAMAIL_TMPDIR}/ext.junk.XXXXXXX` || exit 1
++      else if ( -x /usr/bin/mktemp ) then
++          set TmpExtJunk=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/ext.junk.XXXXXXX` || exit 1
++      else
++          set TmpExtJunk=${METAMAIL_TMPDIR}/ext.junk.$$
++          rm -rf $TmpExtJunk
++      endif
++      cat > $TmpExtJunk <<!
+ This mail message contains a POINTER (reference) to data that is 
+ not included in the message itself.  Rather, the data can be retrieved 
+ by sending a special mail message to a mail server on the network.
+@@ -102,13 +115,13 @@
+ This is the message that will be sent if you choose to go ahead and
+ retreive the external data:
+-Subject: Automated Mail Server Request
+-To: ${server}
+-
+ !
+-      sed -e 1,/^\$/d < $bodyfile >> ${METAMAIL_TMPDIR}/ext.junk.$$
+-      ${METAMAIL_PAGER} ${METAMAIL_TMPDIR}/ext.junk.$$
+-      rm ${METAMAIL_TMPDIR}/ext.junk.$$
++      echo Subject: Automated Mail Server Request >> $TmpExtJunk
++      echo To: "$server" >> $TmpExtJunk
++      echo "" >> $TmpExtJunk
++      sed -e 1,/^\$/d < $bodyfile >> $TmpExtJunk
++      ${METAMAIL_PAGER} $TmpExtJunk
++      rm $TmpExtJunk
+       breaksw
+     default:
+       # IGNORE ALL THE OTHERS -- AUTOMATIC FOR LOCAL-FILE, AFS.
+@@ -157,17 +170,26 @@
+       else
+           set MODECMD="type $mode"
+       endif
++      #  Generate temporary file name:
++      if ( -x /bin/mktemp ) then
++          set TmpFtp=`/bin/mktemp ${METAMAIL_TMPDIR}/mm.ftp.XXXXXXX` || exit 1
++      else if ( -x /usr/bin/mktemp ) then
++          set TmpFtp=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/mm.ftp.XXXXXXX` || exit 1
++      else
++          set TmpFtp=${METAMAIL_TMPDIR}/mm.ftp.$$
++          rm -rf $TmpFtp
++      endif
++      echo open "$site" > $TmpFtp
++      echo user "$username" "$pass" >> $TmpFtp
++      echo "$DIRCMD" >> $TmpFtp
++      echo "$MODECMD" >> $TmpFtp
++      echo get "$name" "$NEWNAME" >> $TmpFtp
++      echo quit >> $TmpFtp
+       echo OBTAINING MESSAGE BODY USING FTP
+-      echo SITE: $site USER $username
+-      $FTP -n <<!
+-open $site
+-user $username $pass
+-$DIRCMD
+-$MODECMD
+-get $name $NEWNAME
+-quit
+-!
+-      if (! -e $NEWNAME) then
++      echo SITE: "$site" USER "$username"
++      $FTP -n < $TmpFtp
++      rm -f $TmpFtp
++      if (! -e "$NEWNAME") then
+           echo FTP failed.
+           cd ${METAMAIL_TMPDIR}
+           rm -rf $TMPDIR
+@@ -176,14 +198,14 @@
+       breaksw
+     case afs:
+     case local-file:
+-      if (! -e $name) then
++      if (! -e "$name") then
+           echo local file not found
+           cd ${METAMAIL_TMPDIR}
+           rm -rf $TMPDIR
+           exit -1
+       endif
+-      set NEWNAME=$name
+-      echo GETTING BODY FROM FILE NAMED: $NEWNAME
++      set NEWNAME="$name"  # Note that this is not trusted data...
++      echo GETTING BODY FROM FILE NAMED: "$NEWNAME"
+       breaksw
+     case mail-server:  # A very special case
+       if ("$bodyfile" == "") then
+@@ -192,12 +214,12 @@
+           rm -rf $TMPDIR
+           exit -1
+       endif
+-      echo Subject: Automated Mail Server Request > $NEWNAME
+-      echo To: ${server} >> $NEWNAME
+-      echo "" >> $NEWNAME
+-      sed -e 1,/^\$/d < $bodyfile >> $NEWNAME
+-      echo "" >> $NEWNAME
+-      /usr/lib/sendmail -t  < $NEWNAME
++      echo Subject: Automated Mail Server Request > "$NEWNAME"
++      echo To: ${server} >> "$NEWNAME"
++      echo "" >> "$NEWNAME"
++      sed -e 1,/^\$/d < $bodyfile >> "$NEWNAME"
++      echo "" >> "$NEWNAME"
++      /usr/lib/sendmail -t  < "$NEWNAME"
+       if ($status) then
+           echo sendmail failed
+           cd ${METAMAIL_TMPDIR}
+@@ -206,7 +228,7 @@
+       endif
+       cd ${METAMAIL_TMPDIR}
+       rm -rf $TMPDIR
+-      echo Your $ctype data has been requested from a mail server.
++      echo Your "$ctype" data has been requested from a mail server.
+       exit 0
+     default:
+       echo UNRECOGNIZED ACCESS-TYPE
+@@ -214,19 +236,19 @@
+       rm -rf $TMPDIR
+       exit -1
+ endsw
+-if ($cenc == base64) then
+-      mimencode -u -b < $NEWNAME > OUT
+-      mv OUT $NEWNAME
+-else if ($cenc == quoted-printable) then
+-      mimencode -u -q < $NEWNAME > OUT
+-      mv OUT $NEWNAME
++if ("$cenc" == base64) then
++      mimencode -u -b < "$NEWNAME" > OUT
++      mv OUT "$NEWNAME"
++else if ("$cenc" == quoted-printable) then
++      mimencode -u -q < "$NEWNAME" > OUT
++      mv OUT "$NEWNAME"
+ endif
+ popd
+-if ($atype == "local-file") then
+-    metamail -p  -b -c "$ctype" $NEWNAME
++if ("$atype" == "local-file") then
++    metamail -p  -b -c "$ctype" "$NEWNAME"
+ else
+-    metamail -p -b -c "$ctype" $TMPDIR/$NEWNAME
++    metamail -p -b -c "$ctype" "$TMPDIR/$NEWNAME"
+ endif
+ if ($status) then
+@@ -236,14 +258,14 @@
+       exit -1
+ endif
+-if ($NEWNAME != $name) then
++if ("$NEWNAME" != "$name") then
+       echo ""
+-      echo The data just displayed is stored in the file $TMPDIR/$NEWNAME
++      echo The data just displayed is stored in the file "$TMPDIR/$NEWNAME"
+       echo "Do you want to delete it?"
+-      rm -i $TMPDIR/$NEWNAME
++      rm -i "$TMPDIR/$NEWNAME"
+ endif
+-if (! -e ${TMPDIR}/${NEWNAME}) then
++if (! -e "${TMPDIR}/${NEWNAME}") then
+     cd ${METAMAIL_TMPDIR}
+     rmdir $TMPDIR
+ endif
+diff -d -r -u -P mm2.7.orig/src/bin/showpartial mm2.7/src/bin/showpartial
+--- mm2.7.orig/src/bin/showpartial     Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/showpartial  Sat Jun 20 14:25:55 1998
+@@ -14,78 +14,84 @@
+ set file="$1"
+ # This next line is because message-id can contain weird chars
+ set id=`echo $2 | tr -d  \!\$\&\*\(\)\|\'\"\;\/\<\>\\` 
+-@ partnum = $3
+-if ($#argv == 3 || $4 == "") then
++@ partnum = "$3"
++if ($#argv == 3 || "$4" == "") then
+     set totalnum=-1
+ else
+     @ totalnum = "$4"
+ endif
+-if (! -d  $TREEROOT)  then
++if ( -d $TREEROOT)  then
++    if (! -o $TREEROOT) then
++        echo Error: You do not own $TREEROOT
++        exit -1
++    endif
++else
+     mkdir $TREEROOT
+     if ($status) then 
+         echo mkdir $TREEROOT failed
+         exit -1
+     endif
+ endif
+-if (! -d ${TREEROOT}/$id) then 
+-    mkdir ${TREEROOT}/$id
++if (! -d "${TREEROOT}/$id") then 
++    mkdir "${TREEROOT}/$id"
+     if ($status) then 
+-        echo mkdir ${TREEROOT}/$id failed
++        echo mkdir "${TREEROOT}/$id" failed
+         exit -1
+     endif
+ endif
+-cp $file ${TREEROOT}/$id/$partnum
++cp "$file" "${TREEROOT}/$id/$partnum"
+ if ($status) then 
+-    echo cp $file ${TREEROOT}/$id/$partnum failed
++    echo cp "$file" "${TREEROOT}/$id/$partnum" failed
+     exit -1
+ endif
+-if ($totalnum == -1) then
+-    if (-e ${TREEROOT}/$id/CT) then
+-      set totalnum=`cat ${TREEROOT}/$id/CT`
++if ("$totalnum" == -1) then
++    if (-e "${TREEROOT}/$id/CT") then
++      set totalnum=`cat "${TREEROOT}/$id/CT"`
+     else
+       set totalnum=-1  #GROSS HACK
+     endif
+ else
+-    echo $totalnum >! ${TREEROOT}/$id/CT
++    echo "$totalnum" >! "${TREEROOT}/$id/CT"
+ endif
+ # Slightly bogus here -- the shell messes up the newlines in the headers
+ # If you put $MM_HEADERS in quotes, it doesn't help.
+-# if ($partnum == 1) then
+-#     echo $MM_HEADERS > ${TREEROOT}/$id/HDRS
++# Note that this could very well constitute a security risk...
++# if ("$partnum" == 1) then
++#     echo $MM_HEADERS > "${TREEROOT}/$id/HDRS"
+ # endif
+ set found=0
+ set ix=1
+ set list=""
+-set limit=$totalnum
+-if ($limit == -1) set limit=25
+-while ($ix <= $limit)
+-    if (-e ${TREEROOT}/$id/$ix) then
++set limit="$totalnum"
++if ("$limit" == -1) set limit=25
++while ("$ix" <= "$limit")
++    if (-e "${TREEROOT}/$id/$ix") then
+       set list="$list $ix"
+       @ found ++
+     endif
+     @ ix ++
+ end
+-if ($found == $totalnum) then
+-    cd ${TREEROOT}/$id
+-    cat $list > ${TREEROOT}/$id/FULL
++if ("$found" == "$totalnum") then
++    cd "${TREEROOT}/$id"
++    cat "$list" > "${TREEROOT}/$id/FULL"
+ #    cat ${TREEROOT}/$id/HDRS $list > ${TREEROOT}/$id/FULL
+-    rm $list
+-    echo All parts of this ${totalnum}-part message have now been read.
+-    metamail -d  ${TREEROOT}/$id/FULL
++    rm "$list"
++    echo All parts of this "${totalnum}"-part message have now been read.
++    metamail -d "${TREEROOT}/$id/FULL"
+     echo WARNING:  To save space, the full file is now being deleted.  
+-    echo You will have to read all $totalnum parts again to see the full message again.
+-    rm ${TREEROOT}/$id/FULL
+-    rm ${TREEROOT}/$id/CT
+-#    rm ${TREEROOT}/$id/HDRS
++    echo You will have to read all "$totalnum" parts again to see the full message again.
++    rm "${TREEROOT}/$id/FULL"
++    rm "${TREEROOT}/$id/CT"
++#    rm "${TREEROOT}/$id/HDRS"
+     cd
+-    rmdir ${TREEROOT}/$id
+-    rmdir ${TREEROOT} >& /dev/null
++    rmdir "${TREEROOT}/$id"
++    rmdir "${TREEROOT}" >& /dev/null
+ else
+-    if (${totalnum} == -1) then
+-        echo So far you have only read $found of the several parts of this message.
++    if ("${totalnum}" == -1) then
++        echo So far you have only read "$found" of the several parts of this message.
+     else
+-        echo So far you have only read $found of the $totalnum parts of this message.
++        echo So far you have only read "$found" of the "$totalnum" parts of this message.
+     endif
+     echo When you have read them all, then you will see the message in full.
+ endif
+diff -d -r -u -P mm2.7.orig/src/bin/showpicture mm2.7/src/bin/showpicture
+--- mm2.7.orig/src/bin/showpicture     Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/showpicture  Sat Jun 20 14:27:26 1998
+@@ -23,7 +23,7 @@
+ set X_VIEWER="xloadimage -view -quiet -geometry +1+1"
+ # set X_VIEWER="xv -geometry +1+1"
+ endif
+-if ($1 == "-viewer" && $#argv > 1) then
++if ("$1" == "-viewer" && $#argv > 1) then
+     set X_VIEWER = "$2"
+     shift
+     shift
+@@ -40,7 +40,15 @@
+     echo be able to see the picture properly.
+     echo ""
+     if ($MM_NOTTTY) then
+-        set fname=${METAMAIL_TMPDIR}/sp.$$
++        #  Generate file name:
++        if ( -x /bin/mktemp ) then
++            set fname=`/bin/mktemp ${METAMAIL_TMPDIR}/sp.XXXXXXX` || exit 1
++        else if ( -x /usr/bin/mktemp ) then
++            set fname=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/sp.XXXXXXX` || exit 1
++        else
++            set fname=${METAMAIL_TMPDIR}/sp.$$
++            rm -rf $fname
++        endif
+         echo "The picture is being automatically stored in the file $fname"
+         echo "If you do not want this file, please delete it."
+     else
+@@ -50,20 +58,28 @@
+         while ( 1 == 1)
+             echo -n "File name:"
+             set fname=$<
+-            if (! -f $fname) then
++            if (! -f "$fname") then
+                 break
+             else
+                 echo "$fname already exists. Try again"
+             endif
+         end
+     endif
+-    cp $1 $fname
+-    if ($status == 0) echo Wrote file $fname
++    cp "$1" "$fname"
++    if ($status == 0) echo Wrote file "$fname"
+     exit 0
+ endif
+ if ($#argv == 0) then
+-    set SQUIRREL=${METAMAIL_TMPDIR}/sp.$$
++    #  Generate file name:
++    if ( -x /bin/mktemp ) then
++        set SQUIRREL=`/bin/mktemp ${METAMAIL_TMPDIR}/sp.XXXXXXX` || exit 1
++    else if ( -x /usr/bin/mktemp ) then
++        set SQUIRREL=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/sp.XXXXXXX` || exit 1
++    else
++        set SQUIRREL=${METAMAIL_TMPDIR}/sp.$$
++        rm -rf $SQUIRREL
++    endif
+     cat > $SQUIRREL
+ else
+     set SQUIRREL="$*"
+diff -d -r -u -P mm2.7.orig/src/bin/sun-audio-file mm2.7/src/bin/sun-audio-file
+--- mm2.7.orig/src/bin/sun-audio-file  Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/sun-audio-file       Sat Jun 20 14:28:11 1998
+@@ -12,7 +12,7 @@
+       exit 1
+ endif
+-uudecode -o $fn < $1
++uudecode -o $fn < "$1"
+ audiotool $fn
+-rm -f $fn $1
++rm -f $fn "$1"
+diff -d -r -u -P mm2.7.orig/src/bin/sun-message.csh mm2.7/src/bin/sun-message.csh
+--- mm2.7.orig/src/bin/sun-message.csh Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/sun-message.csh      Sat Jun 20 14:29:41 1998
+@@ -8,6 +8,10 @@
+ # $2 is untrustworthy data. Quote it.
+ #
+ mkdir /tmp/decode.$$
++if ( $status != 0 ) then
++    echo "Error: cannot create temporary directory"
++    exit 1
++endif
+ cd /tmp/decode.$$
+ if (! $?METAMAIL_PAGER) then
+@@ -21,7 +25,7 @@
+           exit 1
+     endif
+-    uudecode -o $fn $1
++    uudecode -o $fn "$1"
+     echo "The following file was uudecoded:"
+     echo ""
+@@ -40,21 +44,21 @@
+       echo -n "Which do you prefer (1 - 3)? [$defans] "
+       set ans = $< 
+-      if (x$ans == x) then
++      if ("x$ans" == x) then
+           set ans = $defans
+       endif
+-      if ($ans == 3)  then
+-          rm $1
++      if ("$ans" == 3)  then
++          rm "$1"
+           cd /tmp; /bin/rm -rf /tmp/decode.$$
+           exit 0
+-      else if ($ans == 1) then
++      else if ("$ans" == 1) then
+           ${METAMAIL_PAGER} $fn
+-      else if ($ans == 2) then
++      else if ("$ans" == 2) then
+           set nfn = ""
+           echo -n "Save as: $HOME/"
+           set nfn = $<
+-          if (x$nfn != x) then
+-              /bin/cp $fn ${HOME}/$nfn
++          if ("x$nfn" != x) then
++              /bin/cp $fn "${HOME}/$nfn"
+           else
+               echo "Not Saved."
+           endif
+@@ -64,7 +68,7 @@
+       set defans = "3"
+     end
+ else
+-    ${METAMAIL_PAGER} $1
++    ${METAMAIL_PAGER} "$1"
+ endif
+diff -d -r -u -P mm2.7.orig/src/bin/sun-to-mime mm2.7/src/bin/sun-to-mime
+--- mm2.7.orig/src/bin/sun-to-mime     Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/sun-to-mime  Sat Jun 20 14:31:12 1998
+@@ -8,10 +8,19 @@
+     set METAMAIL_TMPDIR=/tmp
+ endif
+-set TMPFILE=${METAMAIL_TMPDIR}/suntomime.$$
++#  Generate temporary file name:
++if ( -x /bin/mktemp ) then
++    set TMPFILE=`/bin/mktemp ${METAMAIL_TMPDIR}/suntomime.XXXXXXX` || exit 1
++else if ( -x /usr/bin/mktemp ) then
++    set TMPFILE=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/suntomime.XXXXXXX` || exit 1
++else
++    set TMPFILE=${METAMAIL_TMPDIR}/suntomime.$$
++    rm -rf $TMPFILE
++endif
++
+ echo "Content-type: multipart/mixed; boundary=--------" > $TMPFILE
+ echo "" >> $TMPFILE
+-sed -e 's/X-Sun-Data-Type:/Content-type:/' >> $TMPFILE < $1
++sed -e 's/X-Sun-Data-Type:/Content-type:/' >> $TMPFILE < "$1"
+ echo "------------" >> $TMPFILE
+ #metamail -d -z $TMPFILE
+ metamail -z $TMPFILE
+diff -d -r -u -P mm2.7.orig/src/bin/sun2mime mm2.7/src/bin/sun2mime
+--- mm2.7.orig/src/bin/sun2mime        Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/sun2mime     Sat Jun 20 14:31:40 1998
+@@ -9,7 +9,16 @@
+ if [ x$METAMAIL_TMPDIR = x ]; then
+     METAMAIL_TMPDIR=/tmp
+ fi
+-TMPFILE=${METAMAIL_TMPDIR}/suntomime.$$
++
++#  Generate temporary file name:
++if [ -x /bin/mktemp ] ; then
++    TMPFILE=`/bin/mktemp ${METAMAIL_TMPDIR}/suntomime.XXXXXXX` || exit 1
++elif [ -x /usr/bin/mktemp ] ; then
++    TMPFILE=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/suntomime.XXXXXXX` || exit 1
++else
++    TMPFILE=${METAMAIL_TMPDIR}/suntomime.$$
++    rm -rf $TMPFILE
++fi
+ /bin/nawk '
+   BEGIN { printf("Content-type: multipart/mixed; boundary=--------\n\n")
+@@ -36,7 +45,7 @@
+       print
+   }
+   END { printf("----------\n") }
+-' $1 > $TMPFILE
++' "$1" > $TMPFILE
+ metamail -z $TMPFILE
+ rm -f $TMPFILE
+diff -d -r -u -P mm2.7.orig/src/metamail/mailto.c mm2.7/src/metamail/mailto.c
+--- mm2.7.orig/src/metamail/mailto.c   Mon Jun 15 00:30:47 1998
++++ mm2.7/src/metamail/mailto.c        Sat Jun 20 16:57:20 1998
+@@ -61,6 +61,7 @@
+ #endif
+ extern char *malloc(), *realloc(), *index(), *getmyname();
++extern FILE *Fopen();
+ struct mailpart *CreateNewPart();
+ /* The main data structure for the multiple parts of the mail */
+@@ -208,7 +209,7 @@
+       pager = getenv("PAGER");
+     strcpy(TmpName, tmpname());
+-    fp = fopen(TmpName, "w");
++    fp = Fopen(TmpName, "w");
+     if (!fp) fp = stdout;
+     fprintf(fp, "The following tilde escapes are BSD-mail-compatible:\n");
+     fprintf(fp, "~? Show help on tilde escapes\n");
+@@ -594,7 +595,7 @@
+     }
+     FirstPart = NewPart();
+     CurrentPart = FirstPart;
+-    fpout = fopen(CurrentPart->filename, "w");
++    fpout = Fopen(CurrentPart->filename, "w");
+     if (!fpout) {
+         fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+         cleanexit(-1);
+@@ -681,7 +682,7 @@
+                     CurrentPart->next = NewPart();
+                     CurrentPart->next->prev = CurrentPart;
+                     CurrentPart = CurrentPart->next;
+-                    fpout = fopen(CurrentPart->filename, "w");
++                    fpout = Fopen(CurrentPart->filename, "w");
+                     if (!fpout) {
+                         fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                         cleanexit(-1);
+@@ -720,7 +721,7 @@
+                     CurrentPart = CurrentPart->next;
+                     CurrentPart->istext = 0;
+                     CurrentPart->content_type = "message/rfc822";
+-                    fpout = fopen(CurrentPart->filename, "w");
++                    fpout = Fopen(CurrentPart->filename, "w");
+                     if (!fpout) {
+                         fprintf(stderr, "mailto: Cannot open temporary file %s\n", CurrentPart->filename);
+                         break;
+@@ -732,7 +733,7 @@
+                     CurrentPart->next = NewPart();
+                     CurrentPart->next->prev = CurrentPart;
+                     CurrentPart = CurrentPart->next;
+-                    fpout = fopen(CurrentPart->filename, "w");
++                    fpout = Fopen(CurrentPart->filename, "w");
+                     if (!fpout) {
+                         fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                         cleanexit(-1);
+@@ -811,11 +812,11 @@
+                     char Cmd[TMPFILE_NAME_SIZE + 15];
+                     char *s=tmpname();
+                     fclose(fpout);
+-                    fptmp = fopen(s, "w");
++                    fptmp = Fopen(s, "w");
+                     WriteOutMessage(fptmp, ToList, Subject, CCList, FirstPart);
+                     TempCloseStyles(fptmp);
+                     fclose(fptmp);
+-                    fpout = fopen(CurrentPart->filename, "a");
++                    fpout = Fopen(CurrentPart->filename, "a");
+                     if (!fpout) {
+                         fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                         cleanexit(-1);
+@@ -899,7 +900,7 @@
+                     char *fname;
+                     fclose(fpout);
+                     fname = start;
+-                    fptmp = fopen(fname, "w");
++                    fptmp = Fopen(fname, "w");
+                     WriteOutMessage(fptmp, ToList, Subject, CCList, FirstPart);
+                     TempCloseStyles(fptmp);
+                     if(fclose(fptmp)) {
+@@ -907,7 +908,7 @@
+                     } else {
+                         printf("Wrote draft to %s\n", fname);
+                     }
+-                    fpout = fopen(CurrentPart->filename, "a");
++                    fpout = Fopen(CurrentPart->filename, "a");
+                     if (!fpout) {
+                         fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                         cleanexit(-1);
+@@ -972,7 +973,7 @@
+                     CurrentPart = CurrentPart->next;
+                     CurrentPart->istext = 0;
+                     CurrentPart->content_type = "message/rfc822";
+-                    fpout = fopen(CurrentPart->filename, "w");
++                    fpout = Fopen(CurrentPart->filename, "w");
+                     if (!fpout) {
+                         fprintf(stderr, "mailto: Cannot open temporary file %s\n", CurrentPart->filename);
+                         break;
+@@ -994,7 +995,7 @@
+                     CurrentPart->next = NewPart();
+                     CurrentPart->next->prev = CurrentPart;
+                     CurrentPart = CurrentPart->next;
+-                    fpout = fopen(CurrentPart->filename, "w");
++                    fpout = Fopen(CurrentPart->filename, "w");
+                     if (!fpout) {
+                         fprintf(stderr, "mailto:  Can't open temporary file %s\n", CurrentPart->filename);
+                         cleanexit(-1);
+@@ -1476,7 +1477,7 @@
+     char DeadFile[1000];
+     sprintf(DeadFile, "%s/dead.letter", gethome());
+-    fp = fopen(DeadFile, "w");
++    fp = Fopen(DeadFile, "w");
+     WriteOutMessage(fp, ToList, Subject, CCList, FirstPart);
+     if(fclose(fp)) {
+         perror("Could not write ~/dead.letter\n");
+@@ -1776,7 +1777,7 @@
+             printf("Cannot read %s, data insertion cancelled\n", sdum);
+             return(NULL);
+         }
+-        fpo = fopen(mp->filename, "w");
++        fpo = Fopen(mp->filename, "w");
+         if (!fpo) {
+             printf("Cannot open temporary file, data insertion cancelled\n");
+             return(NULL);
+@@ -1794,7 +1795,7 @@
+                 int ct;
+                 printf("\nEnter the MIME Content-type value for the data from file %s\n    (type '?' for a list of locally-valid content-types): ", sdum);
+                 fflush(stdout);
+-                gets(LineBuf);
++                fgets(LineBuf, sizeof(LineBuf), stdin);
+                 if (index(LineBuf, '/')) {
+                     char lc[100], *s, AnsBuf[100];
+                     strcpy(lc, LineBuf);
+@@ -1812,7 +1813,7 @@
+                     }
+                     if (mc) break;
+                     printf("The MIME content-type '%s' is not listed in your local mailcap files,\nand may not be a valid MIME type.  Do you want to use it anyway [no] ? ", LineBuf);
+-                    s = gets(AnsBuf);
++                    s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+                     while (s && *s && isspace((unsigned char) *s)) ++s;
+                     if (s && (*s == 'y' || *s == 'Y')) break;
+                     continue;
+@@ -1939,7 +1940,7 @@
+             mp->encoding_type_needed = ENC_NONE;
+         }
+         newfilename = tmpname();
+-        fpout = fopen(newfilename, "w");
++        fpout = Fopen(newfilename, "w");
+         if (!fpout) {
+             fprintf(stderr, "Cannot open file %s for writing, no data included.\n", newfilename);
+             free(CmdBuf);
+@@ -2109,7 +2110,7 @@
+              ContainsEightBitChar(FirstPart->filename)) {
+             FirstPart->encoding_type_needed = ENC_QP;
+         }
+-        fpout = fopen(FirstPart->filename, "a");
++        fpout = Fopen(FirstPart->filename, "a");
+         free(CmdBuf);
+         free(CmdBuf2);
+         return;
+@@ -2159,7 +2160,7 @@
+         lastmp = mp;
+         mp = mp->next;
+     }
+-    fpout = fopen(lastmp->filename, "a");
++    fpout = Fopen(lastmp->filename, "a");
+     free(CmdBuf);
+     free(CmdBuf2);
+ }
+diff -d -r -u -P mm2.7.orig/src/metamail/metamail.c mm2.7/src/metamail/metamail.c
+--- mm2.7.orig/src/metamail/metamail.c Mon Jun 15 00:30:47 1998
++++ mm2.7/src/metamail/metamail.c      Sat Jun 20 16:54:29 1998
+@@ -112,6 +112,7 @@
+ char *FindParam();
+ extern FILE *popen();
++extern FILE *Fopen();
+ static char *nomem = "Out of memory!";
+ static char *mmversion = MM_VERSTRING;
+ static char *NoAskDefault = "text,text/plain,text/richtext";
+@@ -580,7 +581,7 @@
+                                 int overwriteans = -1;
+                                 do {
+                                     printf("File %s exists.  Do you want to overwrite it (y/n) ?\n", Fname);
+-                                    s = gets(AnsBuf);
++                                    s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+                                     if (!s) {
+                                         overwriteans = 0;
+                                     } else {
+@@ -646,7 +647,7 @@
+         if (Fname[0] == 0 || Fname[0] == '\n') {
+             ConsumeRestOfPart(NULL);
+         } else {
+-            fp = fopen(Fname, WRITE_BINARY);
++            fp = Fopen(Fname, WRITE_BINARY);
+             if (!fp) ExitWithError("Cannot open temporary file");
+             TranslateInputToOutput(InputFP, fp, EncodingCode, ContentType);
+             ecode = fclose(fp);
+@@ -961,7 +962,7 @@
+         /* Create it, ugh.  Also needs to affect later command. */
+         MkTmpFileName(TmpName);
+         DeleteSourceFileWhenDone = 1;
+-        fptmp = fopen(TmpName, WRITE_BINARY);
++        fptmp = Fopen(TmpName, WRITE_BINARY);
+         if (!fptmp) ExitWithError("Can't open temporary file\n");
+         while (fgets(LineBuf, LINE_BUF_SIZE, stdin)) {
+             fputs(LineBuf, fptmp);
+@@ -1195,7 +1196,7 @@
+ {
+     int j;
+     FILE *outfp;
+-    outfp = fopen(SquirrelFile, WRITE_BINARY);
++    outfp = Fopen(SquirrelFile, WRITE_BINARY);
+     if (!outfp) {
+         fprintf(stderr, "Cannot open %s to squirrel away a portion of a multipart/alternative\n", SquirrelFile);
+         return(-1);
+@@ -1799,7 +1800,7 @@
+     nameBuf[(cp - def) + 4] = 0;
+     cp++;               /* Now points to value part of environment string. */
+-    if ((envFile = fopen(nameBuf, "w")) == NULL) {
++    if ((envFile = Fopen(nameBuf, "w")) == NULL) {
+         return(2);
+     }
+@@ -1824,7 +1825,7 @@
+         } else {
+             printf("This message contains '%s'-format data.\nDo you want to view it using the '%s' command (y/n) [y] ? ", ctype, ShortCommand(progname));
+         }
+-        s = gets(AnsBuf);
++        s = fgets(AnsBuf, sizeof(AnsBuf), stdin);
+         if (!s) return(0); /* EOF */
+       while (s && *s && isspace((unsigned char) *s)) ++s;
+       if (*s == 'y' || *s == 'Y' || !*s || *s == '\n') return(1);
+@@ -2037,7 +2038,7 @@
+     } else {
+         /* What follows is REALLY bogus, but all my encoding stuff is pipe-oriented right now... */
+         MkTmpFileName(TmpFile);
+-        fp = fopen(TmpFile, WRITE_BINARY);
++        fp = Fopen(TmpFile, WRITE_BINARY);
+         if (!fp) {
+             fprintf(stderr, "Could not open temporary file\n");
+         } else {
+@@ -2192,7 +2193,7 @@
+                             strcpy(thispart->fname, TmpFileNameBuf);
+                             WriteTmpFile(thispart->fname, thispart->ctype);
+                             strcat(TmpFileNameBuf, "H");
+-                            headfp = fopen(TmpFileNameBuf, "w");
++                            headfp = Fopen(TmpFileNameBuf, "w");
+                             if (headfp) {
+                                 fputs(mailheaders+12, headfp);
+                                 /* The +12 gets rid of MM_HEADERS=\n */
+@@ -2298,7 +2299,7 @@
+     FILE *fpout;
+     int retval = 0;
+-    fpout = fopen(fname, WRITE_BINARY);
++    fpout = Fopen(fname, WRITE_BINARY);
+     if (!fpout) {
+         perror("WriteTmpFile");
+         ExitWithError("Can't create temporary file");
+@@ -2519,7 +2520,7 @@
+     FILE *script;
+     MkTmpFileName(nameBuf);
+-    if ((script = fopen(nameBuf, "w")) == NULL) {
++    if ((script = Fopen(nameBuf, "w")) == NULL) {
+         fprintf(stderr, "Unable to open %s for writing\n", nameBuf);
+         exit(1);
+     }
+diff -d -r -u -P mm2.7.orig/src/metamail/shared.c mm2.7/src/metamail/shared.c
+--- mm2.7.orig/src/metamail/shared.c   Mon Jun 15 00:30:47 1998
++++ mm2.7/src/metamail/shared.c        Sat Jun 20 16:51:54 1998
+@@ -1,6 +1,11 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <config.h>
++#include <unistd.h>
++#include <string.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <sys/stat.h>
+ #ifdef SYSV
+ #include <unistd.h>
+ #include <sys/utsname.h>
+@@ -116,5 +121,55 @@
+         initialized = 1;
+     }
+     return(hostname);
++}
++
++
++/*  This fopen wrapper function is designed to avoid /tmp-file race
++ *  conditions where a temporary filename is created and somebody
++ *  throws a link in your way before the fopen(...,"w").  This
++ *  would only happen if another user on the system were actively
++ *  trying to trick you into destroying files.
++ *  Sorry, but "a" mode is not really handled any safer than fopen,
++ *  since I really have no criterium for deciding what files are
++ *  OK to write to.  */
++FILE *Fopen(Fopen_path,Fopen_mode)
++char *Fopen_path; char *Fopen_mode;
++{
++#ifdef MSDOS
++return(fopen(Fopen_path,Fopen_mode));
++#else
++int Fopen_fd;
++struct stat Fopen_sb;
++int Fopen_appendmode = 0;
++int Fopen_readmode = 0;
++int Fopen_openflags = 0;
++int Fopen_r;
++if ( strchr(Fopen_mode,'r') != (char *)0 ) return(fopen(Fopen_path,Fopen_mode));
++if ( strchr(Fopen_mode,'a') != (char *)0 ) Fopen_appendmode = 1;
++if ( strchr(Fopen_mode,'+') != (char *)0 ) Fopen_readmode = 1;
++if ( ( Fopen_appendmode && (strchr(Fopen_mode,'w') != (char *)0) ) ||
++     ( (! Fopen_appendmode) && (strchr(Fopen_mode,'w') == (char *)0) ) )
++    {
++    errno = EINVAL ;
++    return( (FILE *)0 );
++    }
++if ( Fopen_appendmode )
++    {
++    /*  If "a" and file exists, pass it to the real fopen()  */
++    Fopen_r = stat(Fopen_path,&Fopen_sb) ;
++    if ( (Fopen_r != -1) || (errno != ENOENT) )
++        return( fopen(Fopen_path,Fopen_mode) );
++    }
++if ( Fopen_readmode )
++    Fopen_openflags = O_RDWR|O_CREAT|O_EXCL ;
++else
++    Fopen_openflags = O_WRONLY|O_CREAT|O_EXCL ;
++if ( Fopen_appendmode ) Fopen_openflags |= O_APPEND ;
++remove( Fopen_path );
++/*  0666?  We'd better hope their umask is safe...  */
++Fopen_fd = open(Fopen_path,Fopen_openflags,0666);
++if ( Fopen_fd > -1 ) return( fdopen(Fopen_fd,Fopen_mode) );
++return( (FILE *)0 );
++#endif
+ }
+diff -d -r -u -P mm2.7.orig/src/metamail/splitmail.c mm2.7/src/metamail/splitmail.c
+--- mm2.7.orig/src/metamail/splitmail.c        Mon Jun 15 00:30:47 1998
++++ mm2.7/src/metamail/splitmail.c     Sat Jun 20 15:57:02 1998
+@@ -26,6 +26,7 @@
+ #include <config.h>
+ #include <ctype.h>
+ #include <time.h>
++#include <fcntl.h>
+ #define MINCHUNKSIZE 20000 /* Better be enough to hold the headers, or we die! */
+ extern char *malloc(), *index(), *getmyname();
+@@ -243,6 +244,7 @@
+ char *deliverycmd, *prefix, *SharedHeaders, *SubjectBuf, *id, *MessageID, *bigbuf, *OrigID;
+ {
+     FILE *fpout;
++    int fd;
+     char OutputFile[1000];
+     int code;
+ #if defined(sequent)
+@@ -255,7 +257,11 @@
+         fpout = popen(deliverycmd, "w");
+     } else {
+         sprintf(OutputFile, "%s%d", prefix, whichpart);
+-        fpout = fopen(OutputFile, "w");
++        /* fpout = fopen(OutputFile, "w"); */
++        remove(OutputFile);
++        fpout = NULL;
++        fd = open(OutputFile, O_WRONLY|O_CREAT|O_EXCL, 0600);
++        if ( fd > -1 ) fpout = fdopen(fd, "w");
+     }
+     if (!fpout) {
+       fprintf(stderr, "splitmail: Can't open %s for writing\n", DoDeliver ? deliverycmd : OutputFile);
diff --git a/metamail-sunquote.patch b/metamail-sunquote.patch
new file mode 100644 (file)
index 0000000..804091b
--- /dev/null
@@ -0,0 +1,20 @@
+--- mm2.7/src/bin/sun-message.csh~     Tue May 19 10:22:52 1998
++++ mm2.7/src/bin/sun-message.csh      Tue May 19 10:26:39 1998
+@@ -5,6 +5,8 @@
+ # This is sun-message.  It looks at $2 to figure out how to decode $1, then gives the
+ # user a short menu of choices, display, save, or quit.
+ #
++# $2 is untrustworthy data. Quote it.
++#
+ mkdir /tmp/decode.$$
+ cd /tmp/decode.$$
+@@ -12,7 +14,7 @@
+     set METAMAIL_PAGER=more
+ endif
+-if ($2 == "uuencode") then
++if ("$2" == "uuencode") then
+     set fn=`mktemp $METAMAIL_TMPDIR/audio.XXXXXX`
+     test -n "$fn"
+     if $? then
diff --git a/metamail-tmpfile.patch b/metamail-tmpfile.patch
new file mode 100644 (file)
index 0000000..970092f
--- /dev/null
@@ -0,0 +1,114 @@
+diff -d -r -u -P mm2.7.orig/src/bin/mailserver mm2.7/src/bin/mailserver
+--- mm2.7.orig/src/bin/mailserver      Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/mailserver   Mon Jun 15 18:54:01 1998
+@@ -28,7 +28,15 @@
+ rehash
+ set FromName=""
+ set Subject=""
+-set TmpFile=/tmp/ms.$$
++#  Generate temporary file name:
++if ( -x /bin/mktemp ) then
++    set TmpFile=`/bin/mktemp /tmp/ms.XXXXXXX` || exit 1
++else if ( -x /usr/bin/mktemp ) then
++    set TmpFile=`/usr/bin/mktemp /tmp/ms.XXXXXXX` || exit 1
++else
++    set TmpFile=/tmp/ms.$$
++    rm -rf $TmpFile
++endif
+ set FOORAW=$<
+ while ("$FOORAW" != "") 
+ set FOO=(` echo "$FOORAW" | tr "[" "x"`)
+@@ -149,4 +157,5 @@
+ The file: $Subject 
+ was sent to: $FromName
+ !
++rm -f $TmpFile
+ exit 0
+diff -d -r -u -P mm2.7.orig/src/bin/showaudio mm2.7/src/bin/showaudio
+--- mm2.7.orig/src/bin/showaudio       Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/showaudio    Mon Jun 15 19:06:25 1998
+@@ -127,9 +127,18 @@
+     if ($#argv >= 1) then
+       exec /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $*
+     else
+-      cat > ${METAMAIL_TMPDIR}/audio.$$
+-      /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end ${METAMAIL_TMPDIR}/audio.$$
+-      rm ${METAMAIL_TMPDIR}/audio.$$
++      # Generate temporary file name:
++      if ( -x /bin/mktemp ) then
++          set TmpAudio=`/bin/mktemp ${METAMAIL_TMPDIR}/audio.XXXXXXX` || exit 1
++      else if ( -x /usr/bin/mktemp ) then
++          set TmpAudio=`/usr/bin/mktemp ${METAMAIL_TMPDIR}/audio.XXXXXXX` || exit 1
++      else
++          set TmpAudio=${METAMAIL_TMPDIR}/audio.$$
++          rm -rf $TmpAudio
++      endif
++      cat > $TmpAudio
++      /usr/sbin/sfplay -i mu-law chan 1 rate 8000 end $TmpAudio
++      rm $TmpAudio
+       exit 0
+     endif
+ else if (-d /usr/sony) then
+@@ -198,7 +207,15 @@
+ echo ""
+ if (! $?MM_NOTTTY) set MM_NOTTTY=0
+ if ($MM_NOTTTY == 1) then
+-    set fname=/tmp/mm.aud.$$
++    # Generate unique file name:
++    if ( -x /bin/mktemp ) then
++        set fname=`/bin/mktemp /tmp/mm.aud.XXXXXXX` || exit 1
++    else if ( -x /usr/bin/mktemp ) then
++        set fname=`/usr/bin/mktemp /tmp/mm.aud.XXXXXXX` || exit 1
++    else
++        set fname=/tmp/mm.aud.$$
++        rm -rf $fname
++    endif
+ else
+     echo -n "Do you want to write the audio out to a file [y] ? "
+     set ANS=$<
+diff -d -r -u -P mm2.7.orig/src/bin/sun-message.csh mm2.7/src/bin/sun-message.csh
+--- mm2.7.orig/src/bin/sun-message.csh Mon Jun 15 00:30:47 1998
++++ mm2.7/src/bin/sun-message.csh      Mon Jun 15 19:02:09 1998
+@@ -8,6 +8,10 @@
+ # $2 is untrustworthy data. Quote it.
+ #
+ mkdir /tmp/decode.$$
++if ( $? != 0 ) then
++    echo "Error: cannot create temporary directory"
++    exit 1
++endif
+ cd /tmp/decode.$$
+ if (! $?METAMAIL_PAGER) then
+diff -u -d -r -P mm2.7.orig/src/metamail/splitmail.c mm2.7/src/metamail/splitmail.c
+--- mm2.7.orig/src/metamail/splitmail.c        Sun Jun 14 12:00:20 1998
++++ mm2.7/src/metamail/splitmail.c     Sun Jun 14 12:01:09 1998
+@@ -26,6 +26,7 @@
+ #include <config.h>
+ #include <ctype.h>
+ #include <time.h>
++#include <fcntl.h>
+ #define MINCHUNKSIZE 20000 /* Better be enough to hold the headers, or we die! */
+ extern char *malloc(), *index(), *getmyname();
+@@ -243,6 +244,7 @@
+ char *deliverycmd, *prefix, *SharedHeaders, *SubjectBuf, *id, *MessageID, *bigbuf, *OrigID;
+ {
+     FILE *fpout;
++    int fd;
+     char OutputFile[1000];
+     int code;
+ #if defined(sequent)
+@@ -255,7 +257,10 @@
+         fpout = popen(deliverycmd, "w");
+     } else {
+         sprintf(OutputFile, "%s%d", prefix, whichpart);
+-        fpout = fopen(OutputFile, "w");
++      remove(OutputFile);
++      fpout = NULL ;
++      fd = open(OutputFile, O_WRONLY|O_CREAT|O_EXCL, 0600);
++      if ( fd > -1 ) fpout = fdopen(fd, "w");
+     }
+     if (!fpout) {
+       fprintf(stderr, "splitmail: Can't open %s for writing\n", DoDeliver ? deliverycmd : OutputFile);
+
diff --git a/metamail-uudecode.patch b/metamail-uudecode.patch
new file mode 100644 (file)
index 0000000..ea69c2c
--- /dev/null
@@ -0,0 +1,45 @@
+--- mm2.7/src/bin/sun-audio-file.ewt   Fri Oct 24 09:41:11 1997
++++ mm2.7/src/bin/sun-audio-file       Fri Oct 24 09:52:05 1997
+@@ -6,7 +6,13 @@
+     set METAMAIL_TMPDIR=/tmp
+ endif
+-cd ${METAMAIL_TMPDIR}
+-uudecode < $1
+-audiotool audio-file
+-rm -f audio-file $1
++set fn=`mktemp $METAMAIL_TMPDIR/audio.XXXXXX`
++test -n "$fn"
++if $? then
++      exit 1
++endif
++
++uudecode -o $fn < $1
++
++audiotool $fn
++rm -f $fn $1
+--- mm2.7/src/bin/sun-message.csh.ewt  Fri Oct 24 09:44:07 1997
++++ mm2.7/src/bin/sun-message.csh      Fri Oct 24 09:52:30 1997
+@@ -9,7 +9,13 @@
+ cd /tmp/decode.$$
+ if ($2 == "uuencode") then
+-    uudecode $1
++    set fn=`mktemp $METAMAIL_TMPDIR/audio.XXXXXX`
++    test -n "$fn"
++    if $? then
++          exit 1
++    endif
++
++    uudecode -o $fn $1
+     echo "The following file was uudecoded:"
+     echo ""
+@@ -17,7 +23,6 @@
+     set defans = "1"
+     while (1)
+       ls -l
+-      set fn = *
+       echo ""
+       echo "Please choose one:"
This page took 0.227591 seconds and 4 git commands to generate.