Deleted Added
full compact
ugidfw_internal.h (184413) ugidfw_internal.h (184467)
1/*-
2 * Copyright (c) 2008 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * This software was developed by Robert Watson for the TrustedBSD Project.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 2008 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * This software was developed by Robert Watson for the TrustedBSD Project.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/security/mac_bsdextended/ugidfw_internal.h 184413 2008-10-28 13:44:11Z trasz $
28 * $FreeBSD: head/sys/security/mac_bsdextended/ugidfw_internal.h 184467 2008-10-30 10:13:53Z rwatson $
29 */
30
31#ifndef _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H
32#define _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H
33
34/*
35 * Central access control routines used by object-specific checks.
36 */
29 */
30
31#ifndef _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H
32#define _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H
33
34/*
35 * Central access control routines used by object-specific checks.
36 */
37int ugidfw_accmode2mbi(accmode_t accmode);
37int ugidfw_check(struct ucred *cred, struct vnode *vp, struct vattr *vap,
38 int acc_mode);
39int ugidfw_check_vp(struct ucred *cred, struct vnode *vp, int acc_mode);
40
41/*
42 * System access control checks.
43 */
44int ugidfw_system_check_acct(struct ucred *cred, struct vnode *vp,
45 struct label *vplabel);
46int ugidfw_system_check_auditctl(struct ucred *cred, struct vnode *vp,
47 struct label *vplabel);
48int ugidfw_system_check_swapon(struct ucred *cred, struct vnode *vp,
49 struct label *vplabel);
50
51/*
52 * Vnode access control checks.
53 */
54int ugidfw_vnode_check_access(struct ucred *cred, struct vnode *vp,
55 struct label *vplabel, accmode_t accmode);
56int ugidfw_vnode_check_chdir(struct ucred *cred, struct vnode *dvp,
57 struct label *dvplabel);
58int ugidfw_vnode_check_chroot(struct ucred *cred, struct vnode *dvp,
59 struct label *dvplabel);
60int ugidfw_check_create_vnode(struct ucred *cred, struct vnode *dvp,
61 struct label *dvplabel, struct componentname *cnp,
62 struct vattr *vap);
63int ugidfw_vnode_check_deleteacl(struct ucred *cred, struct vnode *vp,
64 struct label *vplabel, acl_type_t type);
65int ugidfw_vnode_check_deleteextattr(struct ucred *cred,
66 struct vnode *vp, struct label *vplabel, int attrnamespace,
67 const char *name);
68int ugidfw_vnode_check_exec(struct ucred *cred, struct vnode *vp,
69 struct label *vplabel, struct image_params *imgp,
70 struct label *execlabel);
71int ugidfw_vnode_check_getacl(struct ucred *cred, struct vnode *vp,
72 struct label *vplabel, acl_type_t type);
73int ugidfw_vnode_check_getextattr(struct ucred *cred, struct vnode *vp,
74 struct label *vplabel, int attrnamespace, const char *name,
75 struct uio *uio);
76int ugidfw_vnode_check_link(struct ucred *cred, struct vnode *dvp,
77 struct label *dvplabel, struct vnode *vp, struct label *label,
78 struct componentname *cnp);
79int ugidfw_vnode_check_listextattr(struct ucred *cred, struct vnode *vp,
80 struct label *vplabel, int attrnamespace);
81int ugidfw_vnode_check_lookup(struct ucred *cred, struct vnode *dvp,
82 struct label *dvplabel, struct componentname *cnp);
83int ugidfw_vnode_check_open(struct ucred *cred, struct vnode *vp,
84 struct label *vplabel, accmode_t accmode);
85int ugidfw_vnode_check_readdir(struct ucred *cred, struct vnode *dvp,
86 struct label *dvplabel);
87int ugidfw_vnode_check_readdlink(struct ucred *cred, struct vnode *vp,
88 struct label *vplabel);
89int ugidfw_vnode_check_rename_from(struct ucred *cred, struct vnode *dvp,
90 struct label *dvplabel, struct vnode *vp, struct label *vplabel,
91 struct componentname *cnp);
92int ugidfw_vnode_check_rename_to(struct ucred *cred, struct vnode *dvp,
93 struct label *dvplabel, struct vnode *vp, struct label *vplabel,
94 int samedir, struct componentname *cnp);
95int ugidfw_vnode_check_revoke(struct ucred *cred, struct vnode *vp,
96 struct label *vplabel);
97int ugidfw_check_setacl_vnode(struct ucred *cred, struct vnode *vp,
98 struct label *vplabel, acl_type_t type, struct acl *acl);
99int ugidfw_vnode_check_setextattr(struct ucred *cred, struct vnode *vp,
100 struct label *vplabel, int attrnamespace, const char *name,
101 struct uio *uio);
102int ugidfw_vnode_check_setflags(struct ucred *cred, struct vnode *vp,
103 struct label *vplabel, u_long flags);
104int ugidfw_vnode_check_setmode(struct ucred *cred, struct vnode *vp,
105 struct label *vplabel, mode_t mode);
106int ugidfw_vnode_check_setowner(struct ucred *cred, struct vnode *vp,
107 struct label *vplabel, uid_t uid, gid_t gid);
108int ugidfw_vnode_check_setutimes(struct ucred *cred, struct vnode *vp,
109 struct label *vplabel, struct timespec atime,
110 struct timespec utime);
111int ugidfw_vnode_check_stat(struct ucred *active_cred,
112 struct ucred *file_cred, struct vnode *vp, struct label *vplabel);
113int ugidfw_vnode_check_unlink(struct ucred *cred, struct vnode *dvp,
114 struct label *dvplabel, struct vnode *vp, struct label *vplabel,
115 struct componentname *cnp);
116
117#endif /* _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H */
38int ugidfw_check(struct ucred *cred, struct vnode *vp, struct vattr *vap,
39 int acc_mode);
40int ugidfw_check_vp(struct ucred *cred, struct vnode *vp, int acc_mode);
41
42/*
43 * System access control checks.
44 */
45int ugidfw_system_check_acct(struct ucred *cred, struct vnode *vp,
46 struct label *vplabel);
47int ugidfw_system_check_auditctl(struct ucred *cred, struct vnode *vp,
48 struct label *vplabel);
49int ugidfw_system_check_swapon(struct ucred *cred, struct vnode *vp,
50 struct label *vplabel);
51
52/*
53 * Vnode access control checks.
54 */
55int ugidfw_vnode_check_access(struct ucred *cred, struct vnode *vp,
56 struct label *vplabel, accmode_t accmode);
57int ugidfw_vnode_check_chdir(struct ucred *cred, struct vnode *dvp,
58 struct label *dvplabel);
59int ugidfw_vnode_check_chroot(struct ucred *cred, struct vnode *dvp,
60 struct label *dvplabel);
61int ugidfw_check_create_vnode(struct ucred *cred, struct vnode *dvp,
62 struct label *dvplabel, struct componentname *cnp,
63 struct vattr *vap);
64int ugidfw_vnode_check_deleteacl(struct ucred *cred, struct vnode *vp,
65 struct label *vplabel, acl_type_t type);
66int ugidfw_vnode_check_deleteextattr(struct ucred *cred,
67 struct vnode *vp, struct label *vplabel, int attrnamespace,
68 const char *name);
69int ugidfw_vnode_check_exec(struct ucred *cred, struct vnode *vp,
70 struct label *vplabel, struct image_params *imgp,
71 struct label *execlabel);
72int ugidfw_vnode_check_getacl(struct ucred *cred, struct vnode *vp,
73 struct label *vplabel, acl_type_t type);
74int ugidfw_vnode_check_getextattr(struct ucred *cred, struct vnode *vp,
75 struct label *vplabel, int attrnamespace, const char *name,
76 struct uio *uio);
77int ugidfw_vnode_check_link(struct ucred *cred, struct vnode *dvp,
78 struct label *dvplabel, struct vnode *vp, struct label *label,
79 struct componentname *cnp);
80int ugidfw_vnode_check_listextattr(struct ucred *cred, struct vnode *vp,
81 struct label *vplabel, int attrnamespace);
82int ugidfw_vnode_check_lookup(struct ucred *cred, struct vnode *dvp,
83 struct label *dvplabel, struct componentname *cnp);
84int ugidfw_vnode_check_open(struct ucred *cred, struct vnode *vp,
85 struct label *vplabel, accmode_t accmode);
86int ugidfw_vnode_check_readdir(struct ucred *cred, struct vnode *dvp,
87 struct label *dvplabel);
88int ugidfw_vnode_check_readdlink(struct ucred *cred, struct vnode *vp,
89 struct label *vplabel);
90int ugidfw_vnode_check_rename_from(struct ucred *cred, struct vnode *dvp,
91 struct label *dvplabel, struct vnode *vp, struct label *vplabel,
92 struct componentname *cnp);
93int ugidfw_vnode_check_rename_to(struct ucred *cred, struct vnode *dvp,
94 struct label *dvplabel, struct vnode *vp, struct label *vplabel,
95 int samedir, struct componentname *cnp);
96int ugidfw_vnode_check_revoke(struct ucred *cred, struct vnode *vp,
97 struct label *vplabel);
98int ugidfw_check_setacl_vnode(struct ucred *cred, struct vnode *vp,
99 struct label *vplabel, acl_type_t type, struct acl *acl);
100int ugidfw_vnode_check_setextattr(struct ucred *cred, struct vnode *vp,
101 struct label *vplabel, int attrnamespace, const char *name,
102 struct uio *uio);
103int ugidfw_vnode_check_setflags(struct ucred *cred, struct vnode *vp,
104 struct label *vplabel, u_long flags);
105int ugidfw_vnode_check_setmode(struct ucred *cred, struct vnode *vp,
106 struct label *vplabel, mode_t mode);
107int ugidfw_vnode_check_setowner(struct ucred *cred, struct vnode *vp,
108 struct label *vplabel, uid_t uid, gid_t gid);
109int ugidfw_vnode_check_setutimes(struct ucred *cred, struct vnode *vp,
110 struct label *vplabel, struct timespec atime,
111 struct timespec utime);
112int ugidfw_vnode_check_stat(struct ucred *active_cred,
113 struct ucred *file_cred, struct vnode *vp, struct label *vplabel);
114int ugidfw_vnode_check_unlink(struct ucred *cred, struct vnode *dvp,
115 struct label *dvplabel, struct vnode *vp, struct label *vplabel,
116 struct componentname *cnp);
117
118#endif /* _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H */