File: shtool_tempfile.dpatch

package info (click to toggle)
mysql-ocaml 1.0.4-2%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 728 kB
  • ctags: 717
  • sloc: sh: 2,278; ml: 599; ansic: 531; makefile: 74; perl: 41
file content (28 lines) | stat: -rw-r--r-- 1,099 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /bin/sh /usr/share/dpatch/dpatch-run
## shtool_tempfile.dpatch by Samuel Mimram <smimram@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: shtool creates temporary files in an insecure manner, which can be
## DP: exploited through symlink attacks. Please see these URLs for details:
## DP: http://www.zataz.net/adviso/shtool-05252005.txt
## DP: http://bugs.gentoo.org/show_bug.cgi?id=93782

@DPATCH@
diff -urNad --exclude=CVS --exclude=.svn ./etc/shtool /tmp/dpep-work.f6mb29/mysql-ocaml-1.0.3/etc/shtool
--- ./etc/shtool	2004-01-27 20:46:36.000000000 +0100
+++ /tmp/dpep-work.f6mb29/mysql-ocaml-1.0.3/etc/shtool	2005-07-18 23:52:08.000000000 +0200
@@ -378,7 +378,13 @@
             tmpdir="$TEMPDIR"
         fi
     fi
-    tmpfile="$tmpdir/.shtool.$$"
+    if mkdir "$tmpdir/.shtool.$$"; then
+        tmpfile="$tmpdir/.shtool.$$/shtool.tmp"
+    else
+        echo "$msgprefix:Error: failed to create temporary file" 1>&2
+        exit 1
+    fi
+    tmpfile="$tmpdir/.shtool.$$/shtool.tmp"
     rm -f $tmpfile >/dev/null 2>&1
     touch $tmpfile
 fi