From owner-svn-src-all@FreeBSD.ORG Sat Mar 13 12:02:44 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EB1F1065676; Sat, 13 Mar 2010 12:02:44 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DD488FC25; Sat, 13 Mar 2010 12:02:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o2DC2iCd013361; Sat, 13 Mar 2010 12:02:44 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o2DC2icf013359; Sat, 13 Mar 2010 12:02:44 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201003131202.o2DC2icf013359@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 13 Mar 2010 12:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r205121 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2010 12:02:44 -0000 Author: jh Date: Sat Mar 13 12:02:44 2010 New Revision: 205121 URL: http://svn.freebsd.org/changeset/base/205121 Log: 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 Reported by: Jon Passki MFC after: 1 week Modified: head/etc/rc.d/tmp Modified: head/etc/rc.d/tmp ============================================================================== --- head/etc/rc.d/tmp Sat Mar 13 11:51:18 2010 (r205120) +++ head/etc/rc.d/tmp Sat Mar 13 12:02:44 2010 (r205121) @@ -51,8 +51,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!"