xref: /titanic_52/usr/src/lib/libbsm/common/bsm.c (revision 1d842814faabbb6af3e2fe30a4bd61aa4a70eeb3)
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 2006 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 auditsvc(int fd, int limit)
38 {
39 	return (syscall(SYS_auditsys, BSM_AUDITSVC, fd, limit));
40 }
41 
42 int
43 auditdoor(int fd)
44 {
45 	return (syscall(SYS_auditsys, BSM_AUDITDOOR, fd));
46 }
47 
48 
49 int
50 audit(char *record, int length)
51 {
52 	return (syscall(SYS_auditsys, BSM_AUDIT, record, length));
53 }
54 
55 
56 int
57 getauid(au_id_t *auid)
58 {
59 	return (syscall(SYS_auditsys, BSM_GETAUID, auid));
60 }
61 
62 
63 int
64 setauid(au_id_t *auid)
65 {
66 	return (syscall(SYS_auditsys, BSM_SETAUID, auid));
67 }
68 
69 
70 int
71 getuseraudit(au_id_t uid, au_mask_t *mask)
72 {
73 	return (syscall(SYS_auditsys, BSM_GETUSERAUDIT, uid, mask));
74 }
75 
76 
77 int
78 setuseraudit(au_id_t uid, au_mask_t *mask)
79 {
80 	return (syscall(SYS_auditsys, BSM_SETUSERAUDIT, uid, mask));
81 }
82 
83 
84 int
85 getaudit(auditinfo_t *ai)
86 {
87 	return (syscall(SYS_auditsys, BSM_GETAUDIT, ai));
88 }
89 
90 int
91 getaudit_addr(auditinfo_addr_t *ai, int len)
92 {
93 	return (syscall(SYS_auditsys, BSM_GETAUDIT_ADDR, ai, len));
94 }
95 
96 
97 int
98 setaudit(auditinfo_t *ai)
99 {
100 	return (syscall(SYS_auditsys, BSM_SETAUDIT, ai));
101 }
102 
103 
104 int
105 setaudit_addr(auditinfo_addr_t *ai, int len)
106 {
107 	return (syscall(SYS_auditsys, BSM_SETAUDIT_ADDR, ai, len));
108 }
109 
110 
111 int
112 getkernstate(au_mask_t *mask)
113 {
114 	return (syscall(SYS_auditsys, BSM_GETKERNSTATE, mask));
115 }
116 
117 
118 int
119 setkernstate(au_mask_t *mask)
120 {
121 	return (syscall(SYS_auditsys, BSM_SETKERNSTATE, mask));
122 }
123 
124 
125 int
126 auditon(int cmd, caddr_t data, int length)
127 {
128 	return (syscall(SYS_auditsys, BSM_AUDITCTL, cmd, data, length));
129 }
130 
131 
132 int
133 auditstat(au_stat_t *stat)
134 {
135 	return (syscall(SYS_auditsys, BSM_AUDITSTAT, stat));
136 }
137