xref: /openbsd-src/share/man/man9/vaccess.9 (revision dddd2645fd99df9cea4bd12d510ca892fff2f643)
1*dddd2645Sschwarze.\"     $OpenBSD: vaccess.9,v 1.9 2013/06/04 19:27:15 schwarze Exp $
2ac0b1781Scsapuntz.\"-
3ac0b1781Scsapuntz.\" Copyright (c) 2001 Robert N. M. Watson
4ac0b1781Scsapuntz.\" All rights reserved.
5ac0b1781Scsapuntz.\"
6ac0b1781Scsapuntz.\" Redistribution and use in source and binary forms, with or without
7ac0b1781Scsapuntz.\" modification, are permitted provided that the following conditions
8ac0b1781Scsapuntz.\" are met:
9ac0b1781Scsapuntz.\" 1. Redistributions of source code must retain the above copyright
10ac0b1781Scsapuntz.\"    notice, this list of conditions and the following disclaimer.
11ac0b1781Scsapuntz.\" 2. Redistributions in binary form must reproduce the above copyright
12ac0b1781Scsapuntz.\"    notice, this list of conditions and the following disclaimer in the
13ac0b1781Scsapuntz.\"    documentation and/or other materials provided with the distribution.
14ac0b1781Scsapuntz.\"
15ac0b1781Scsapuntz.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16ac0b1781Scsapuntz.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17ac0b1781Scsapuntz.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18ac0b1781Scsapuntz.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19ac0b1781Scsapuntz.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20ac0b1781Scsapuntz.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21ac0b1781Scsapuntz.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22ac0b1781Scsapuntz.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23ac0b1781Scsapuntz.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24ac0b1781Scsapuntz.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25ac0b1781Scsapuntz.\" SUCH DAMAGE.
26ac0b1781Scsapuntz.\"
27ac0b1781Scsapuntz.\"
28*dddd2645Sschwarze.Dd $Mdocdate: June 4 2013 $
29ac0b1781Scsapuntz.Dt VACCESS 9
30b00e7293Sjmc.Os
31ac0b1781Scsapuntz.Sh NAME
32ac0b1781Scsapuntz.Nm vaccess
33db5918d3Sjmc.Nd check access permissions based on vnode parameters
34ac0b1781Scsapuntz.Sh SYNOPSIS
35*dddd2645Sschwarze.In sys/param.h
36*dddd2645Sschwarze.In sys/vnode.h
37ac0b1781Scsapuntz.Ft int
38ac0b1781Scsapuntz.Fo vaccess
39c27ee045Sjmc.Fa "enum vtype type"
40ac0b1781Scsapuntz.Fa "mode_t file_mode"
41ac0b1781Scsapuntz.Fa "uid_t uid"
42ac0b1781Scsapuntz.Fa "gid_t gid"
43ac0b1781Scsapuntz.Fa "mode_t acc_mode"
44ac0b1781Scsapuntz.Fa "struct ucred *cred"
45ac0b1781Scsapuntz.Fc
46ac0b1781Scsapuntz.Sh DESCRIPTION
47ac0b1781ScsapuntzThe
48ac0b1781Scsapuntz.Fn vaccess
49ac0b1781Scsapuntzfunction checks if the credentials described in
50ac0b1781Scsapuntz.Fa cred
5142fe4b8cSdavidare sufficient to perform the operation described by
52ac0b1781Scsapuntz.Fa acc_mode ,
53ac0b1781Scsapuntzbased on the
54c27ee045Sjmc.Fa type ,
55ac0b1781Scsapuntz.Fa file_mode ,
56ac0b1781Scsapuntz.Fa uid ,
57ac0b1781Scsapuntzand
58ac0b1781Scsapuntz.Fa gid
594c8a7c32Smpecharguments.
604c8a7c32SmpechThese arguments would typically be based on the vnode being
61ac0b1781Scsapuntzaccessed.
62ac0b1781Scsapuntz.Pp
63ac0b1781Scsapuntz.Fa file_mode
644c8a7c32Smpechis the current mode of the file that is having access checked.
654c8a7c32SmpechThe
66ac0b1781Scsapuntz.Fa uid
67ac0b1781Scsapuntzand
68ac0b1781Scsapuntz.Fa gid
69ac0b1781Scsapuntzarguments are the user id and group id representing the owner of the file.
70ac0b1781Scsapuntz.Fa acc_mode
71db5918d3Sjmcdescribes the operation desired.
724c8a7c32SmpechIt should be one of
73ac0b1781Scsapuntz.Dv VREAD ,
74db5918d3Sjmc.Dv VWRITE ,
75ac0b1781Scsapuntzor
76ac0b1781Scsapuntz.Dv VEXEC
77db5918d3Sjmcrepresenting read, write, and execute, respectively.
78ac0b1781Scsapuntz.Sh RETURN VALUES
79ac0b1781Scsapuntz.Fn vaccess
80ac0b1781Scsapuntzwill return 0 on success, or a non-zero error value on failure.
81ac0b1781Scsapuntz.Sh ERRORS
82ac0b1781Scsapuntz.Bl -tag -width Er
83ac0b1781Scsapuntz.It Bq Er EACCES
84ac0b1781ScsapuntzPermission denied.
85ac0b1781ScsapuntzAn attempt was made to access a file in a way forbidden by its file access
86ac0b1781Scsapuntzpermissions.
87ac0b1781Scsapuntz.El
88ac0b1781Scsapuntz.Sh SEE ALSO
89ac0b1781Scsapuntz.Xr vnode 9
90ac0b1781Scsapuntz.Sh HISTORY
91ac0b1781ScsapuntzThis man page was originally written by
92ac0b1781Scsapuntz.An Robert Watson
934c8a7c32Smpechfor
944c8a7c32Smpech.Fx .
954c8a7c32SmpechIt was modified to represent the
964c8a7c32Smpech.Ox
974c8a7c32Smpechimplementation by
984c8a7c32Smpech.An Peter Werner .
99