xref: /titanic_50/usr/src/lib/libbsm/common/bsm.c (revision b5d3ab78446c645a1150b57b7a58b535229ee742)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include <sys/syscall.h>
29 #include <sys/types.h>
30 #include <bsm/audit.h>
31 #include <sys/socket.h>
32 #include <sys/param.h>
33 
34 const char *bsm_dom = TEXT_DOMAIN;
35 
36 int
37 auditdoor(int fd)
38 {
39 	return (syscall(SYS_auditsys, BSM_AUDITDOOR, fd));
40 }
41 
42 
43 int
44 audit(char *record, int length)
45 {
46 	return (syscall(SYS_auditsys, BSM_AUDIT, record, length));
47 }
48 
49 
50 int
51 getauid(au_id_t *auid)
52 {
53 	return (syscall(SYS_auditsys, BSM_GETAUID, auid));
54 }
55 
56 
57 int
58 setauid(au_id_t *auid)
59 {
60 	return (syscall(SYS_auditsys, BSM_SETAUID, auid));
61 }
62 
63 
64 int
65 getuseraudit(au_id_t uid, au_mask_t *mask)
66 {
67 	return (syscall(SYS_auditsys, BSM_GETUSERAUDIT, uid, mask));
68 }
69 
70 
71 int
72 setuseraudit(au_id_t uid, au_mask_t *mask)
73 {
74 	return (syscall(SYS_auditsys, BSM_SETUSERAUDIT, uid, mask));
75 }
76 
77 
78 int
79 getaudit(auditinfo_t *ai)
80 {
81 	return (syscall(SYS_auditsys, BSM_GETAUDIT, ai));
82 }
83 
84 int
85 getaudit_addr(auditinfo_addr_t *ai, int len)
86 {
87 	return (syscall(SYS_auditsys, BSM_GETAUDIT_ADDR, ai, len));
88 }
89 
90 
91 int
92 setaudit(auditinfo_t *ai)
93 {
94 	return (syscall(SYS_auditsys, BSM_SETAUDIT, ai));
95 }
96 
97 
98 int
99 setaudit_addr(auditinfo_addr_t *ai, int len)
100 {
101 	return (syscall(SYS_auditsys, BSM_SETAUDIT_ADDR, ai, len));
102 }
103 
104 
105 int
106 getkernstate(au_mask_t *mask)
107 {
108 	return (syscall(SYS_auditsys, BSM_GETKERNSTATE, mask));
109 }
110 
111 
112 int
113 setkernstate(au_mask_t *mask)
114 {
115 	return (syscall(SYS_auditsys, BSM_SETKERNSTATE, mask));
116 }
117 
118 
119 int
120 auditon(int cmd, caddr_t data, int length)
121 {
122 	return (syscall(SYS_auditsys, BSM_AUDITCTL, cmd, data, length));
123 }
124 
125 
126 int
127 auditstat(au_stat_t *stat)
128 {
129 	return (syscall(SYS_auditsys, BSM_AUDITSTAT, stat));
130 }
131