Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Mar 2011 20:59:02 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219463 - head/tools/regression/pjdfstest/tests/chmod
Message-ID:  <201103102059.p2AKx2YH055790@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Thu Mar 10 20:59:02 2011
New Revision: 219463
URL: http://svn.freebsd.org/changeset/base/219463

Log:
  Improve test a bit, now that we have fstat(2) support.
  The test was support to check if SUID/SGID bits are removed on first
  write, but actually we were checking if they were removed after close.
  Now we can check if SUID/SGID bits are gone after first write.
  
  While here add checks to see if when both SUID and SGID bits are set they are
  both cleared on first write.

Modified:
  head/tools/regression/pjdfstest/tests/chmod/12.t

Modified: head/tools/regression/pjdfstest/tests/chmod/12.t
==============================================================================
--- head/tools/regression/pjdfstest/tests/chmod/12.t	Thu Mar 10 20:37:54 2011	(r219462)
+++ head/tools/regression/pjdfstest/tests/chmod/12.t	Thu Mar 10 20:59:02 2011	(r219463)
@@ -6,7 +6,7 @@ desc="verify SUID/SGID bit behaviour"
 dir=`dirname $0`
 . ${dir}/../misc.sh
 
-echo "1..10"
+echo "1..14"
 
 n0=`namegen`
 n1=`namegen`
@@ -18,13 +18,19 @@ cd ${n2}
 
 # Check whether writing to the file by non-owner clears the SUID.
 expect 0 create ${n0} 04777
-expect 0 -u 65534 -g 65534 open ${n0} O_WRONLY : write 0 x
+expect 0777 -u 65534 -g 65534 open ${n0} O_WRONLY : write 0 x : fstat 0 mode
 expect 0777 stat ${n0} mode
 expect 0 unlink ${n0}
 
 # Check whether writing to the file by non-owner clears the SGID.
 expect 0 create ${n0} 02777
-expect 0 -u 65534 -g 65534 open ${n0} O_RDWR : write 0 x
+expect 0777 -u 65534 -g 65534 open ${n0} O_RDWR : write 0 x : fstat 0 mode
+expect 0777 stat ${n0} mode
+expect 0 unlink ${n0}
+
+# Check whether writing to the file by non-owner clears the SUID+SGID.
+expect 0 create ${n0} 06777
+expect 0777 -u 65534 -g 65534 open ${n0} O_RDWR : write 0 x : fstat 0 mode
 expect 0777 stat ${n0} mode
 expect 0 unlink ${n0}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103102059.p2AKx2YH055790>