1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<table class="head">
<tr>
<td class="head-ltitle">VACCESS(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">VACCESS(9)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">vaccess</code> — <span class="Nd">generate
an access control decision using vnode parameters</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">sys/param.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/vnode.h</a>></code></p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">vaccess</code>(<var class="Fa">enum vtype type</var>,
<var class="Fa">mode_t file_mode</var>, <var class="Fa">uid_t
file_uid</var>, <var class="Fa">gid_t file_gid</var>,
<var class="Fa">accmode_t accmode</var>, <var class="Fa">struct ucred
*cred</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">This call implements the logic for the
<span class="Ux">UNIX</span> discretionary file security model common to
many file systems in <span class="Ux">FreeBSD</span>. It accepts the vnodes
type <var class="Fa">type</var>, permissions via
<var class="Fa">file_mode</var>, owning UID <var class="Fa">file_uid</var>,
owning GID <var class="Fa">file_gid</var>, desired access mode
<var class="Fa">accmode</var> and requesting credential
<var class="Fa">cred</var>.</p>
<p class="Pp" id="vaccess">This call is intended to support implementations of
<a class="Xr">VOP_ACCESS(9)</a>, which will use their own access methods to
retrieve the vnode properties, and then invoke
<a class="permalink" href="#vaccess"><code class="Fn">vaccess</code></a>()
in order to perform the actual check. Implementations of
<a class="Xr">VOP_ACCESS(9)</a> may choose to implement additional security
mechanisms whose results will be composed with the return value.</p>
<p class="Pp" id="vaccess~2">The algorithm used by
<a class="permalink" href="#vaccess~2"><code class="Fn">vaccess</code></a>()
selects a component of the file permission bits based on comparing the
passed credential, file owner, and file group. If the credential's effective
UID matches the file owner, then the owner component of the permission bits
is selected. If the UID does not match, then the credential's effective GID,
followed by additional groups, are compared with the file group—if
there is a match, then the group component of the permission bits is
selected. If neither the credential UID or GIDs match the passed file owner
and group, then the other component of the permission bits is selected.</p>
<p class="Pp">Once appropriate protections are selected for the current
credential, the requested access mode, in combination with the vnode type,
will be compared with the discretionary rights available for the credential.
If the rights granted by discretionary protections are insufficient, then
super-user privilege, if available for the credential, will also be
considered.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<p class="Pp"><code class="Fn">vaccess</code>() will return 0 on success, or a
non-zero error value on failure.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<dl class="Bl-tag">
<dt id="EACCES">[<a class="permalink" href="#EACCES"><code class="Er">EACCES</code></a>]</dt>
<dd>Permission denied. An attempt was made to access a file in a way forbidden
by its file access permissions.</dd>
<dt id="EPERM">[<a class="permalink" href="#EPERM"><code class="Er">EPERM</code></a>]</dt>
<dd>Operation not permitted. An attempt was made to perform an operation
limited to processes with appropriate privileges or to the owner of a file
or other resource.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">vaccess_acl_nfs4(9)</a>,
<a class="Xr">vaccess_acl_posix1e(9)</a>, <a class="Xr">vnode(9)</a>,
<a class="Xr">VOP_ACCESS(9)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">This manual page and the current implementation of
<code class="Fn">vaccess</code>() were written by <span class="An">Robert
Watson</span>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">August 23, 2022</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|