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.
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.
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]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 #include <sys/types.h>
30 #include <sys/fcntl.h>
31 #include <bsm/audit.h>
32 #include <bsm/audit_record.h>
33 #include <bsm/audit_uevents.h>
34 #include <bsm/libbsm.h>
35 #include <bsm/audit_private.h>
39 #include <netinet/in.h>
45 #define dprintf(x) { (void) printf x; }
50 static mutex_t audit_mountd_lock
= DEFAULTMUTEX
;
51 static int cannotaudit
= 0;
54 * This setup call is made only once at the start of mountd.
55 * The call sets the auditing state off if appropriate, and is
56 * made in single threaded code, hence no locking is required.
61 dprintf(("audit_mountd_setup()\n"));
69 audit_mountd_mount(clname
, path
, sorf
)
70 char *clname
; /* client name */
71 char *path
; /* mount path */
72 int sorf
; /* flag for success or failure */
74 uint32_t buf
[4], type
;
75 dprintf(("audit_mountd_mount()\n"));
80 (void) mutex_lock(&audit_mountd_lock
);
82 (void) aug_save_namask();
85 aug_save_event(AUE_mountd_mount
);
87 aug_save_text(clname
);
89 (void) aug_get_machine(clname
, buf
, &type
);
90 aug_save_tid_ex(aug_get_port(), buf
, type
);
92 (void) mutex_unlock(&audit_mountd_lock
);
96 audit_mountd_umount(clname
, path
)
97 char *clname
; /* client name */
98 char *path
; /* mount path */
100 uint32_t buf
[4], type
;
102 dprintf(("audit_mountd_mount()\n"));
107 (void) mutex_lock(&audit_mountd_lock
);
109 (void) aug_save_namask();
111 (void) aug_save_me();
112 aug_save_event(AUE_mountd_umount
);
114 aug_save_text(clname
);
116 (void) aug_get_machine(clname
, buf
, &type
);
117 aug_save_tid_ex(aug_get_port(), buf
, type
);
119 (void) mutex_unlock(&audit_mountd_lock
);