Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 May 2010 03:48:44 GMT
From:      Jonathan Anderson <jona@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 178362 for review
Message-ID:  <201005170348.o4H3miuY038136@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@178362?ac=10

Change 178362 by jona@jona-belle-freebsd8 on 2010/05/17 03:48:27

	Added regression test case: fcntl(x) should fail with ENOTCAPABLE (rather than EBADF) when x does not have CAP_FCNTL

Affected files ...

.. //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_fcntl.c#2 edit

Differences ...

==== //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_fcntl.c#2 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$P4: //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_fcntl.c#1 $");
+__FBSDID("$P4: //depot/projects/trustedbsd/capabilities/src/tools/regression/security/cap_test/cap_test_fcntl.c#2 $");
 
 #include <sys/types.h>
 #include <sys/capability.h>
@@ -101,6 +101,13 @@
 
 		else if(fcntl(files[i].fd, F_GETFL, 0) == -1)
 			warnx("Error calling fcntl('%s', F_GETFL)", files[i].name);
+
+		else if (fcntl(cap_new(files[i].fd, 0), F_GETFL, 0) == -1)
+		{
+			if(errno != ENOTCAPABLE)
+				warn("fcntl('%s', F_GETFL) failed, but errno"
+				     " != ENOTCAPABLE", files[i].name);
+		}
 	}
 }
 



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