From owner-svn-src-all@FreeBSD.ORG Fri Aug 5 17:43:12 2011 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 2F4C1106566B; Fri, 5 Aug 2011 17:43:12 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 061DF8FC15; Fri, 5 Aug 2011 17:43:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p75HhBE0015341; Fri, 5 Aug 2011 17:43:11 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p75HhBo5015339; Fri, 5 Aug 2011 17:43:11 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201108051743.p75HhBo5015339@svn.freebsd.org> From: Jonathan Anderson Date: Fri, 5 Aug 2011 17:43:11 +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: r224660 - head/tools/regression/security/cap_test 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: Fri, 05 Aug 2011 17:43:12 -0000 Author: jonathan Date: Fri Aug 5 17:43:11 2011 New Revision: 224660 URL: http://svn.freebsd.org/changeset/base/224660 Log: Expect fchflags(2) to fail with EOPNOTSUPP on NFS. Even if we have CAP_FCHFLAGS, fchflags(2) fails on NFS. This is normal and expected, so don't fail the test because of it. Note that, whether or not we are on NFS, fchflags(2) should always fail with ENOTCAPABLE if we are using a capability that does not have the CAP_FCHFLAGS right. Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc Modified: head/tools/regression/security/cap_test/cap_test_capabilities.c Modified: head/tools/regression/security/cap_test/cap_test_capabilities.c ============================================================================== --- head/tools/regression/security/cap_test/cap_test_capabilities.c Fri Aug 5 17:33:12 2011 (r224659) +++ head/tools/regression/security/cap_test/cap_test_capabilities.c Fri Aug 5 17:43:11 2011 (r224660) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "cap_test.h" @@ -102,9 +103,13 @@ try_file_ops(int fd, cap_rights_t rights off_t off; void *p; char ch; - int ret; + int ret, is_nfs; int success = PASSED; + REQUIRE(fstatfs(fd, &sf)); + is_nfs = (strncmp("nfs", sf.f_fstypename, sizeof(sf.f_fstypename)) + == 0); + REQUIRE(fd_cap = cap_new(fd, rights)); REQUIRE(fd_capcap = cap_new(fd_cap, rights)); CHECK(fd_capcap != fd_cap); @@ -126,8 +131,12 @@ try_file_ops(int fd, cap_rights_t rights off = lseek(fd_cap, 0, SEEK_SET); CHECK_RESULT(lseek, CAP_SEEK, off >= 0); + /* + * Note: this is not expected to work over NFS. + */ ret = fchflags(fd_cap, UF_NODUMP); - CHECK_RESULT(fchflags, CAP_FCHFLAGS, ret == 0); + CHECK_RESULT(fchflags, CAP_FCHFLAGS, + (ret == 0) || (is_nfs && (errno == EOPNOTSUPP))); ret = fstat(fd_cap, &sb); CHECK_RESULT(fstat, CAP_FSTAT, ret == 0);