svn commit: r205883 - stable/6/etc/rc.d

Jaakko Heinonen jh at FreeBSD.org
Tue Mar 30 15:26:13 UTC 2010


Author: jh
Date: Tue Mar 30 15:26:12 2010
New Revision: 205883
URL: http://svn.freebsd.org/changeset/base/205883

Log:
  MFC r205121:
  
  Use an unique directory name instead of hardcoded /tmp/.diskless.
  A malicious user could create a file named /tmp/.diskless and cause
  the script to misbehave.
  
  PR:		conf/141258

Modified:
  stable/6/etc/rc.d/tmp
Directory Properties:
  stable/6/etc/   (props changed)

Modified: stable/6/etc/rc.d/tmp
==============================================================================
--- stable/6/etc/rc.d/tmp	Tue Mar 30 15:25:16 2010	(r205882)
+++ stable/6/etc/rc.d/tmp	Tue Mar 30 15:26:12 2010	(r205883)
@@ -49,8 +49,8 @@ case "${tmpmfs}" in
 [Nn][Oo])
 	;;
 *)
-	if /bin/mkdir -p /tmp/.diskless 2> /dev/null; then
-		rmdir /tmp/.diskless
+	if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then
+		rmdir ${_tmpdir}
 	else
 		if [ -h /tmp ]; then
 			echo "*** /tmp is a symlink to a non-writable area!"


More information about the svn-src-stable-6 mailing list