From paul@mail.continuity.cx  Sun Feb 16 02:59:34 2003
Return-Path: <paul@mail.continuity.cx>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2E4AD37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Feb 2003 02:59:34 -0800 (PST)
Received: from mail.continuity.cx (mail.continuity.cx [64.141.71.230])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B6B1B43F3F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 16 Feb 2003 02:59:33 -0800 (PST)
	(envelope-from paul@mail.continuity.cx)
Received: by mail.continuity.cx (Postfix, from userid 1005)
	id B4B0A3DD; Sun, 16 Feb 2003 03:00:30 -0800 (PST)
Message-Id: <20030216110030.B4B0A3DD@mail.continuity.cx>
Date: Sun, 16 Feb 2003 03:00:30 -0800 (PST)
From: Paul Guyot <pguyot@kallisys.net>
Reply-To: Paul Guyot <pguyot@kallisys.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: /etc/periodic/security/100.chksetuid doesn't work with spaces in mount points
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         48325
>Category:       conf
>Synopsis:       [patch] /etc/periodic/security/100.chksetuid doesn't work with spaces in mount points
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 16 03:00:30 PST 2003
>Closed-Date:    
>Last-Modified:  Mon Jan 14 01:10:41 UTC 2008
>Originator:     Paul Guyot
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
Kallisys
>Environment:
MacOS X
>Description:
	If one has spaces in a mount point, then 100.chksetuid doesn't work (it fails for these mount points).
	Having a space can occur on FreeBSD and is much more likely to happen on MacOS X where one just has to put a space in a volume's name.
	Additionally, it doesn't handle hfs volumes.
>How-To-Repeat:
	Create a UFS mount point with a space in its path (e.g. "/Volumes/Foo Bar") and then run periodic security.
>Fix:
	Apply this patch:
--- 100.chksetuid.old	Fri Oct 25 17:14:16 2002
+++ 100.chksetuid	Sun Feb 16 11:43:59 2003
@@ -44,21 +44,13 @@
 	echo ""
 	echo 'Checking setuid files and devices:'
 	# XXX Note that there is the possibility of overrunning the args to ls
-	MP=`mount -t ufs | grep -v " nosuid" | awk '{ print $3 }' | sort`
-	if [ -n "${MP}" ]
-	then
-	    set ${MP}
-	    while [ $# -ge 1 ]; do
-	        mount=$1
-	        shift
-	        find $mount -xdev -type f \
-			\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
-			\( -perm -u+s -or -perm -g+s \) -print0
-	    done | xargs -0 -n 20 ls -liTd | sed 's/^ *//' | sort -k 11 |
+	(mount -t hfs && mount -t ufs) | grep -v " nosuid" |
+		sed -n -e 's/^.* on \(.*\) (.*local.*)/\1/p' |
+		awk '{ printf "find \"%s\" -xdev -type f \\( -perm -u+x -or -perm -g+x -or -perm -o+x \\) \\( -perm -u+s -or -perm -g+s \\) -print0\n", $0 }' |
+		sort | sh | xargs -0 -n 20 ls -liTd | sed 's/^ *//' | sort -k 11 |
 	      check_diff setuid - "${host} setuid diffs:"
-	    rc=$?
-	fi;;
+	rc=$?;;
     *)	rc=0;;
 esac
 
-exit $rc
+exit $rc

>Release-Note:
>Audit-Trail:
>Unformatted:
