diff options
author | jedgar <jedgar@FreeBSD.org> | 2001-01-20 04:30:41 +0000 |
---|---|---|
committer | jedgar <jedgar@FreeBSD.org> | 2001-01-20 04:30:41 +0000 |
commit | 33aed99e3f536c4fa8350864ed155272114bb9b6 (patch) | |
tree | a7bfa154a01cbd2cbca6792fc9d17cf1d1c48606 /usr.sbin/manctl | |
parent | cf5b2e3c3be9fc98dc2fe0b284bf95f26709dff4 (diff) | |
download | FreeBSD-src-33aed99e3f536c4fa8350864ed155272114bb9b6.zip FreeBSD-src-33aed99e3f536c4fa8350864ed155272114bb9b6.tar.gz |
Use more secure temporary files using mktemp(1)
Submitted by: Mike Heffner <mheffner@vt.edu>
Diffstat (limited to 'usr.sbin/manctl')
-rw-r--r-- | usr.sbin/manctl/manctl.sh | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/manctl/manctl.sh b/usr.sbin/manctl/manctl.sh index 43a1511..23e2087 100644 --- a/usr.sbin/manctl/manctl.sh +++ b/usr.sbin/manctl/manctl.sh @@ -94,12 +94,13 @@ uncompress_page() else if [ $2 != "symbolic" ] ; then echo gunzipping page $pname 1>&2 - gunzip -c $pname > /tmp/manager.$$ + temp=`mktemp -t manager` || exit 1 + gunzip -c $pname > $temp chmod u+w $pname - cp /tmp/manager.$$ $pname + cp $temp $pname chmod 444 $pname mv $pname $fname.$sect - rm /tmp/manager.$$ + rm -f $temp else # skip symlinks - this can be # a program like expn, which is @@ -180,11 +181,13 @@ so_purge_page() ln ../$2 $fname else echo inlining page $fname 1>&2 + temp=`mktemp -t manager` || exit 1 cat $fname | \ - (cd .. ; soelim ) > /tmp/manager.$$ + (cd .. ; soelim ) > $temp chmod u+w $fname - cp /tmp/manager.$$ $fname + cp $temp $fname chmod 444 $fname + rm -f $temp fi } @@ -279,13 +282,14 @@ compress_page() else if [ $2 != "symbolic" ] ; then echo gzipping page $pname 1>&2 + temp=`mktemp -t manager` || exit 1 cat $pname | \ - (cd .. ; soelim )| gzip -c -- > /tmp/manager.$$ + (cd .. ; soelim )| gzip -c -- > $temp chmod u+w $pname - cp /tmp/manager.$$ $pname + cp $temp $pname chmod 444 $pname mv $pname $pname.gz - rm /tmp/manager.$$ + rm -f $temp else # skip symlink - this can be # a program like expn, which is |