1184331Srwatson/*-
2184331Srwatson * Copyright (c) 2008 Robert N. M. Watson
3184331Srwatson * All rights reserved.
4184331Srwatson *
5184332Srwatson * This software was developed by Robert Watson for the TrustedBSD Project.
6184332Srwatson *
7184331Srwatson * Redistribution and use in source and binary forms, with or without
8184331Srwatson * modification, are permitted provided that the following conditions
9184331Srwatson * are met:
10184331Srwatson * 1. Redistributions of source code must retain the above copyright
11184331Srwatson *    notice, this list of conditions and the following disclaimer.
12184331Srwatson * 2. Redistributions in binary form must reproduce the above copyright
13184331Srwatson *    notice, this list of conditions and the following disclaimer in the
14184331Srwatson *    documentation and/or other materials provided with the distribution.
15184331Srwatson *
16184331Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17184331Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18184331Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19184331Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20184331Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21184331Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22184331Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23184331Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24184331Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25184331Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26184331Srwatson * SUCH DAMAGE.
27184331Srwatson *
28184331Srwatson * $FreeBSD: releng/11.0/sys/security/mac_bsdextended/ugidfw_internal.h 189533 2009-03-08 12:32:06Z rwatson $
29184331Srwatson */
30184331Srwatson
31184331Srwatson#ifndef _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H
32184331Srwatson#define	_SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H
33184331Srwatson
34184331Srwatson/*
35184331Srwatson * Central access control routines used by object-specific checks.
36184331Srwatson */
37184467Srwatsonint	ugidfw_accmode2mbi(accmode_t accmode);
38184331Srwatsonint	ugidfw_check(struct ucred *cred, struct vnode *vp, struct vattr *vap,
39184331Srwatson	    int acc_mode);
40184331Srwatsonint	ugidfw_check_vp(struct ucred *cred, struct vnode *vp, int acc_mode);
41184331Srwatson
42184331Srwatson/*
43184331Srwatson * System access control checks.
44184331Srwatson */
45184331Srwatsonint	ugidfw_system_check_acct(struct ucred *cred, struct vnode *vp,
46184331Srwatson	    struct label *vplabel);
47184331Srwatsonint	ugidfw_system_check_auditctl(struct ucred *cred, struct vnode *vp,
48184331Srwatson	    struct label *vplabel);
49184331Srwatsonint	ugidfw_system_check_swapon(struct ucred *cred, struct vnode *vp,
50184331Srwatson	    struct label *vplabel);
51184331Srwatson
52184331Srwatson/*
53184331Srwatson * Vnode access control checks.
54184331Srwatson */
55184331Srwatsonint	ugidfw_vnode_check_access(struct ucred *cred, struct vnode *vp,
56184413Strasz	    struct label *vplabel, accmode_t accmode);
57184331Srwatsonint	ugidfw_vnode_check_chdir(struct ucred *cred, struct vnode *dvp,
58184331Srwatson	    struct label *dvplabel);
59184331Srwatsonint	ugidfw_vnode_check_chroot(struct ucred *cred, struct vnode *dvp,
60184331Srwatson	    struct label *dvplabel);
61184331Srwatsonint	ugidfw_check_create_vnode(struct ucred *cred, struct vnode *dvp,
62184331Srwatson	    struct label *dvplabel, struct componentname *cnp,
63184331Srwatson	    struct vattr *vap);
64184331Srwatsonint	ugidfw_vnode_check_deleteacl(struct ucred *cred, struct vnode *vp,
65184331Srwatson	    struct label *vplabel, acl_type_t type);
66184331Srwatsonint	ugidfw_vnode_check_deleteextattr(struct ucred *cred,
67184331Srwatson	    struct vnode *vp, struct label *vplabel, int attrnamespace,
68184331Srwatson	    const char *name);
69184331Srwatsonint	ugidfw_vnode_check_exec(struct ucred *cred, struct vnode *vp,
70184331Srwatson	    struct label *vplabel, struct image_params *imgp,
71184331Srwatson	    struct label *execlabel);
72184331Srwatsonint	ugidfw_vnode_check_getacl(struct ucred *cred, struct vnode *vp,
73184331Srwatson	    struct label *vplabel, acl_type_t type);
74184331Srwatsonint	ugidfw_vnode_check_getextattr(struct ucred *cred, struct vnode *vp,
75189533Srwatson	    struct label *vplabel, int attrnamespace, const char *name);
76184331Srwatsonint	ugidfw_vnode_check_link(struct ucred *cred, struct vnode *dvp,
77184331Srwatson	    struct label *dvplabel, struct vnode *vp, struct label *label,
78184331Srwatson	    struct componentname *cnp);
79184331Srwatsonint	ugidfw_vnode_check_listextattr(struct ucred *cred, struct vnode *vp,
80184331Srwatson	    struct label *vplabel, int attrnamespace);
81184331Srwatsonint	ugidfw_vnode_check_lookup(struct ucred *cred, struct vnode *dvp,
82184331Srwatson	    struct label *dvplabel, struct componentname *cnp);
83184331Srwatsonint	ugidfw_vnode_check_open(struct ucred *cred, struct vnode *vp,
84184413Strasz	    struct label *vplabel, accmode_t accmode);
85184331Srwatsonint	ugidfw_vnode_check_readdir(struct ucred *cred, struct vnode *dvp,
86184331Srwatson	    struct label *dvplabel);
87184331Srwatsonint	ugidfw_vnode_check_readdlink(struct ucred *cred, struct vnode *vp,
88184331Srwatson	    struct label *vplabel);
89184331Srwatsonint	ugidfw_vnode_check_rename_from(struct ucred *cred, struct vnode *dvp,
90184331Srwatson	    struct label *dvplabel, struct vnode *vp, struct label *vplabel,
91184331Srwatson	    struct componentname *cnp);
92184331Srwatsonint	ugidfw_vnode_check_rename_to(struct ucred *cred, struct vnode *dvp,
93184331Srwatson	    struct label *dvplabel, struct vnode *vp, struct label *vplabel,
94184331Srwatson	    int samedir, struct componentname *cnp);
95184331Srwatsonint	ugidfw_vnode_check_revoke(struct ucred *cred, struct vnode *vp,
96184331Srwatson	    struct label *vplabel);
97184331Srwatsonint	ugidfw_check_setacl_vnode(struct ucred *cred, struct vnode *vp,
98184331Srwatson	    struct label *vplabel, acl_type_t type, struct acl *acl);
99184331Srwatsonint	ugidfw_vnode_check_setextattr(struct ucred *cred, struct vnode *vp,
100189533Srwatson	    struct label *vplabel, int attrnamespace, const char *name);
101184331Srwatsonint	ugidfw_vnode_check_setflags(struct ucred *cred, struct vnode *vp,
102184331Srwatson	    struct label *vplabel, u_long flags);
103184331Srwatsonint	ugidfw_vnode_check_setmode(struct ucred *cred, struct vnode *vp,
104184331Srwatson	    struct label *vplabel, mode_t mode);
105184331Srwatsonint	ugidfw_vnode_check_setowner(struct ucred *cred, struct vnode *vp,
106184331Srwatson	    struct label *vplabel, uid_t uid, gid_t gid);
107184331Srwatsonint	ugidfw_vnode_check_setutimes(struct ucred *cred, struct vnode *vp,
108184331Srwatson	    struct label *vplabel, struct timespec atime,
109184331Srwatson	    struct timespec utime);
110184331Srwatsonint	ugidfw_vnode_check_stat(struct ucred *active_cred,
111184331Srwatson	    struct ucred *file_cred, struct vnode *vp, struct label *vplabel);
112184331Srwatsonint	ugidfw_vnode_check_unlink(struct ucred *cred, struct vnode *dvp,
113184331Srwatson	    struct label *dvplabel, struct vnode *vp, struct label *vplabel,
114184331Srwatson	    struct componentname *cnp);
115184331Srwatson
116184331Srwatson#endif /* _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H */
117