xref: /openbsd-src/share/man/man9/vaccess.9 (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1.\"     $OpenBSD: vaccess.9,v 1.6 2007/05/31 19:20:01 jmc 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.\"
28.Dd $Mdocdate: May 31 2007 $
29.Os
30.Dt VACCESS 9
31.Sh NAME
32.Nm vaccess
33.Nd check access permissions based on vnode parameters
34.Sh SYNOPSIS
35.Fd #include <sys/param.h>
36.Fd #include <sys/vnode.h>
37.Ft int
38.Fo vaccess
39.Fa "mode_t file_mode"
40.Fa "uid_t uid"
41.Fa "gid_t gid"
42.Fa "mode_t acc_mode"
43.Fa "struct ucred *cred"
44.Fc
45.Sh DESCRIPTION
46The
47.Fn vaccess
48function checks if the credentials described in
49.Fa cred
50are sufficient to perform the operation described by
51.Fa acc_mode ,
52based on the
53.Fa file_mode ,
54.Fa uid ,
55and
56.Fa gid
57arguments.
58These arguments would typically be based on the vnode being
59accessed.
60.Pp
61.Fa file_mode
62is the current mode of the file that is having access checked.
63The
64.Fa uid
65and
66.Fa gid
67arguments are the user id and group id representing the owner of the file.
68.Fa acc_mode
69describes the operation desired.
70It should be one of
71.Dv VREAD ,
72.Dv VWRITE ,
73or
74.Dv VEXEC
75representing read, write, and execute, respectively.
76.Sh RETURN VALUES
77.Fn vaccess
78will return 0 on success, or a non-zero error value on failure.
79.Sh ERRORS
80.Bl -tag -width Er
81.It Bq Er EACCES
82Permission denied.
83An attempt was made to access a file in a way forbidden by its file access
84permissions.
85.El
86.Sh SEE ALSO
87.Xr vnode 9
88.Sh HISTORY
89This man page was originally written by
90.An Robert Watson
91for
92.Fx .
93It was modified to represent the
94.Ox
95implementation by
96.An Peter Werner .
97