xref: /onnv-gate/usr/src/lib/libbsm/common/bsm.c (revision 9083:a9161047a8e1)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52827Stz204579  * Common Development and Distribution License (the "License").
62827Stz204579  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*9083SJan.Friedel@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #include <sys/syscall.h>
270Sstevel@tonic-gate #include <sys/types.h>
280Sstevel@tonic-gate #include <bsm/audit.h>
290Sstevel@tonic-gate #include <sys/socket.h>
300Sstevel@tonic-gate #include <sys/param.h>
310Sstevel@tonic-gate 
320Sstevel@tonic-gate const char *bsm_dom = TEXT_DOMAIN;
330Sstevel@tonic-gate 
340Sstevel@tonic-gate int
auditdoor(int fd)350Sstevel@tonic-gate auditdoor(int fd)
360Sstevel@tonic-gate {
370Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_AUDITDOOR, fd));
380Sstevel@tonic-gate }
390Sstevel@tonic-gate 
400Sstevel@tonic-gate 
410Sstevel@tonic-gate int
audit(char * record,int length)420Sstevel@tonic-gate audit(char *record, int length)
430Sstevel@tonic-gate {
440Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_AUDIT, record, length));
450Sstevel@tonic-gate }
460Sstevel@tonic-gate 
470Sstevel@tonic-gate 
480Sstevel@tonic-gate int
getauid(au_id_t * auid)490Sstevel@tonic-gate getauid(au_id_t *auid)
500Sstevel@tonic-gate {
510Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_GETAUID, auid));
520Sstevel@tonic-gate }
530Sstevel@tonic-gate 
540Sstevel@tonic-gate 
550Sstevel@tonic-gate int
setauid(au_id_t * auid)560Sstevel@tonic-gate setauid(au_id_t *auid)
570Sstevel@tonic-gate {
580Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_SETAUID, auid));
590Sstevel@tonic-gate }
600Sstevel@tonic-gate 
610Sstevel@tonic-gate 
620Sstevel@tonic-gate int
getaudit(auditinfo_t * ai)630Sstevel@tonic-gate getaudit(auditinfo_t *ai)
640Sstevel@tonic-gate {
650Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_GETAUDIT, ai));
660Sstevel@tonic-gate }
670Sstevel@tonic-gate 
680Sstevel@tonic-gate int
getaudit_addr(auditinfo_addr_t * ai,int len)690Sstevel@tonic-gate getaudit_addr(auditinfo_addr_t *ai, int len)
700Sstevel@tonic-gate {
710Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_GETAUDIT_ADDR, ai, len));
720Sstevel@tonic-gate }
730Sstevel@tonic-gate 
740Sstevel@tonic-gate 
750Sstevel@tonic-gate int
setaudit(auditinfo_t * ai)760Sstevel@tonic-gate setaudit(auditinfo_t *ai)
770Sstevel@tonic-gate {
780Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_SETAUDIT, ai));
790Sstevel@tonic-gate }
800Sstevel@tonic-gate 
810Sstevel@tonic-gate 
820Sstevel@tonic-gate int
setaudit_addr(auditinfo_addr_t * ai,int len)830Sstevel@tonic-gate setaudit_addr(auditinfo_addr_t *ai, int len)
840Sstevel@tonic-gate {
850Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_SETAUDIT_ADDR, ai, len));
860Sstevel@tonic-gate }
870Sstevel@tonic-gate 
880Sstevel@tonic-gate 
890Sstevel@tonic-gate int
auditon(int cmd,caddr_t data,int length)900Sstevel@tonic-gate auditon(int cmd, caddr_t data, int length)
910Sstevel@tonic-gate {
920Sstevel@tonic-gate 	return (syscall(SYS_auditsys, BSM_AUDITCTL, cmd, data, length));
930Sstevel@tonic-gate }
94