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