General:
 
 Changes to 1.37.39:
+19Sep05
+- Fix handling of temp file in mtx_changer.in, reported as
+  a security bug, but it is not really.  Bug #422
+- Fix security problem of handling temp file in randpass.
+  Bug #422.
+- During label/relabel, add new_volume to VOLRES list in SD.
 18Sep05
 - Apply Landon's patch for the TLS ANS1 API change.
 - Remove old code.
 
 #
 
 MTX=@MTX@
-# Set this to a directory that only the SD can read/write
-TMPDIR=@working_dir@
+TMPFILE=`mktemp mtx.XXXXXXXXXX`
+if test x${TMPFILE} = x; then
+   TMPFILE="@working_dir@/mtx.$$"
+   if test -f ${TMPFILE}; then
+      echo "Temp file security problem on: ${TMPFILE}"
+      exit 1
+   fi
+fi
 
 #
 # The purpose of this function to wait a maximum 
 device=$4
 drive=$5
 
+
 #
 # Check for special cases where only 2 arguments are needed, 
 #  all others are a minimum of 3
 
    list) 
 #     echo "Doing mtx -f $ctl -- to list volumes"
-      ${MTX} -f $ctl status >${TMPDIR}/mtx.$$
+      ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
-      cat ${TMPDIR}/mtx.$$ | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
-      cat ${TMPDIR}/mtx.$$ | grep "^Data Transfer Element [0-9]*:Full (Storage Element [0-9]" | awk '{printf "%s:%s\n",$7,$10}'
-      rm -f ${TMPDIR}/mtx.$$ 2>&1 >/dev/null
+      cat ${TMPFILE} | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
+      cat ${TMPFILE} | grep "^Data Transfer Element [0-9]*:Full (Storage Element [0-9]" | awk '{printf "%s:%s\n",$7,$10}'
+      rm -f ${TMPFILE} 2>&1 >/dev/null
 #
 # If you have a VXA PacketLoader and the above does not work, try
 #  turning it off and enabling the following line.
 
    loaded)
 #     echo "Doing mtx -f $ctl $drive -- to find what is loaded"
-      ${MTX} -f $ctl status >${TMPDIR}/mtx.$$
+      ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
-      cat ${TMPDIR}/mtx.$$ | grep "^Data Transfer Element $drive:Full" | awk "{print \$7}"
-      cat ${TMPDIR}/mtx.$$ | grep "^Data Transfer Element $drive:Empty" | awk "{print 0}"
-      rm -f ${TMPDIR}/mtx.$$ 2>&1 >/dev/null
+      cat ${TMPFILE} | grep "^Data Transfer Element $drive:Full" | awk "{print \$7}"
+      cat ${TMPFILE} | grep "^Data Transfer Element $drive:Empty" | awk "{print 0}"
+      rm -f ${TMPFILE} 2>&1 >/dev/null
       exit $rtn
       ;;