1.\" $NetBSD: genfs_can_access_acl_nfs4.9,v 1.1 2022/01/17 19:08:06 christos Exp $ 2.\"- 3.\" Copyright (c) 2001 Robert N. M. Watson 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.\" $FreeBSD: head/share/man/man9/genfs_can_access_acl_nfs4.9 267936 2014-06-26 21:44:30Z bapt $ 28.\" 29.Dd September 18, 2009 30.Dt GENFS_CAN_ACCESS_ACL_NFS4 9 31.Os 32.Sh NAME 33.Nm genfs_can_access_acl_nfs4 34.Nd generate a NFSv4 ACL access control decision using vnode parameters 35.Sh SYNOPSIS 36.In miscfs/genfs/genfs.h 37.Ft int 38.Fo genfs_can_access_acl_nfs4 39 genfs_can_access_acl_nfs4(struct vnode *, kauth_cred_t, uid_t, gid_t, 40 mode_t, struct acl *, accmode_t) 41.Fa "struct vnode *vp" 42.Fa "kath_cred_t cred" 43.Fa "uid_t file_uid" 44.Fa "gid_t file_gid" 45.Fa "mode_t file_mode" 46.Fa "struct acl *acl" 47.Fa "accmode_t accmode" 48.Fc 49.Sh DESCRIPTION 50This call implements the logic for the 51.Ux 52discretionary file security model 53with NFSv4 ACL extensions. 54It accepts the vnode 55.Fa vp , 56requesting credential 57.Fa cred , 58owning UID 59.Fa file_uid , 60owning GID 61.Fa file_gid , 62file permissions 63.Fa file_mode , 64access ACL for the file 65.Fa acl , 66desired access mode 67.Fa accmode , 68.Pp 69This call is intended to support implementations of 70.Xr VOP_ACCESS 9 , 71which will use their own access methods to retrieve the vnode properties, 72and then invoke 73.Fn genfs_can_access_acl_nfs4 74in order to perform the actual check. 75Implementations of 76.Xr VOP_ACCESS 9 77may choose to implement additional security mechanisms whose results will 78be composed with the return value. 79.Pp 80The algorithm used by 81.Fn genfs_can_access_acl_nfs4 82is based on the NFSv4 ACL evaluation algorithm, as described in 83NFSv4 Minor Version 1, draft-ietf-nfsv4-minorversion1-21.txt. 84The algorithm selects a 85.Em matching 86entry from the access ACL, which may 87then be composed with an available ACL mask entry, providing 88.Ux 89security compatibility. 90.Pp 91Once appropriate protections are selected for the current credential, 92the requested access mode, in combination with the vnode type, will be 93compared with the discretionary rights available for the credential. 94If the rights granted by discretionary protections are insufficient, 95then super-user privilege, if available for the credential, will also be 96considered. 97.Sh RETURN VALUES 98.Fn genfs_can_access_acl_nfs4 99will return 0 on success, or a non-zero error value on failure. 100.Sh ERRORS 101.Bl -tag -width Er 102.It Bq Er EACCES 103Permission denied. 104An attempt was made to access a file in a way forbidden by its file access 105permissions. 106.It Bq Er EPERM 107Operation not permitted. 108An attempt was made to perform an operation limited to processes with 109appropriate privileges or to the owner of a file or other resource. 110.El 111.Sh SEE ALSO 112.Xr genfs_can_access 9 , 113.Xr vnode 9 , 114.Xr VOP_ACCESS 9 115.Sh AUTHORS 116Current implementation of 117.Fn genfs_can_access_acl_nfs4 118was written by 119.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org . 120.Sh BUGS 121This manual page should include a full description of the NFSv4 ACL 122evaluation algorithm, or cross reference another page that does. 123