]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - sys/security/mac/mac_audit.c
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / sys / security / mac / mac_audit.c
1 /*-
2  * Copyright (c) 1999-2002 Robert N. M. Watson
3  * Copyright (c) 2001 Ilmar S. Habibulin
4  * Copyright (c) 2001-2004 Networks Associates Technology, Inc.
5  *
6  * This software was developed by Robert Watson and Ilmar Habibulin for the
7  * TrustedBSD Project.
8  *
9  * This software was developed for the FreeBSD Project in part by Network
10  * Associates Laboratories, the Security Research Division of Network
11  * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
12  * as part of the DARPA CHATS research program.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  */
35
36 #include <sys/cdefs.h>
37 __FBSDID("$FreeBSD$");
38
39 #include <sys/param.h>
40 #include <sys/module.h>
41 #include <sys/vnode.h>
42
43 #include <security/audit/audit.h>
44
45 #include <security/mac/mac_framework.h>
46 #include <security/mac/mac_internal.h>
47 #include <security/mac/mac_policy.h>
48
49 int
50 mac_check_proc_setaudit(struct ucred *cred, struct auditinfo *ai)
51 {
52         int error;
53
54         MAC_CHECK(check_proc_setaudit, cred, ai);
55
56         return (error);
57 }
58
59 int
60 mac_check_proc_setaudit_addr(struct ucred *cred, struct auditinfo_addr *aia)
61 {
62         int error;
63
64         MAC_CHECK(check_proc_setaudit_addr, cred, aia);
65
66         return (error);
67 }
68
69 int
70 mac_check_proc_setauid(struct ucred *cred, uid_t auid)
71 {
72         int error;
73
74         MAC_CHECK(check_proc_setauid, cred, auid);
75
76         return (error);
77 }
78
79 int
80 mac_check_system_audit(struct ucred *cred, void *record, int length)
81 {
82         int error;
83
84         MAC_CHECK(check_system_audit, cred, record, length);
85
86         return (error);
87 }
88
89 int
90 mac_check_system_auditctl(struct ucred *cred, struct vnode *vp)
91 {
92         int error;
93         struct label *vl;
94
95         ASSERT_VOP_LOCKED(vp, "mac_check_system_auditctl");
96
97         vl = (vp != NULL) ? vp->v_label : NULL;
98
99         MAC_CHECK(check_system_auditctl, cred, vp, vl);
100
101         return (error);
102 }
103
104 int
105 mac_check_system_auditon(struct ucred *cred, int cmd)
106 {
107         int error;
108
109         MAC_CHECK(check_system_auditon, cred, cmd);
110
111         return (error);
112 }