From owner-svn-src-all@FreeBSD.ORG Sun May 23 08:12:36 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 B0C51106564A; Sun, 23 May 2010 08:12:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FAC98FC1E; Sun, 23 May 2010 08:12:36 +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 o4N8CaUu016422; Sun, 23 May 2010 08:12:36 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4N8CaR3016419; Sun, 23 May 2010 08:12:36 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201005230812.o4N8CaR3016419@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 23 May 2010 08:12:36 +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: r208437 - head/lib/libc/posix1e 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: Sun, 23 May 2010 08:12:36 -0000 Author: trasz Date: Sun May 23 08:12:36 2010 New Revision: 208437 URL: http://svn.freebsd.org/changeset/base/208437 Log: Make acl_get_perm_np(3) work with NFSv4 ACLs. Reviewed by: kientzle@ MFC after: 1 week Modified: head/lib/libc/posix1e/acl_get.c head/lib/libc/posix1e/acl_perm.c Modified: head/lib/libc/posix1e/acl_get.c ============================================================================== --- head/lib/libc/posix1e/acl_get.c Sun May 23 07:53:22 2010 (r208436) +++ head/lib/libc/posix1e/acl_get.c Sun May 23 08:12:36 2010 (r208437) @@ -132,30 +132,6 @@ acl_get_fd_np(int fd, acl_type_t type) return (aclp); } -int -acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm) -{ - - if (permset_d == NULL) { - errno = EINVAL; - return (-1); - } - - switch(perm) { - case ACL_READ: - case ACL_WRITE: - case ACL_EXECUTE: - if (*permset_d & perm) - return (1); - break; - default: - errno = EINVAL; - return (-1); - } - - return (0); -} - /* * acl_get_permset() (23.4.17): return via permset_p a descriptor to * the permission set in the ACL entry entry_d. Modified: head/lib/libc/posix1e/acl_perm.c ============================================================================== --- head/lib/libc/posix1e/acl_perm.c Sun May 23 07:53:22 2010 (r208436) +++ head/lib/libc/posix1e/acl_perm.c Sun May 23 08:12:36 2010 (r208437) @@ -108,3 +108,21 @@ acl_delete_perm(acl_permset_t permset_d, return (0); } + +int +acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm) +{ + + if (permset_d == NULL) { + errno = EINVAL; + return (-1); + } + + if (_perm_is_invalid(perm)) + return (-1); + + if (*permset_d & perm) + return (1); + + return (0); +}