8030 libmvect: uninitialized variable
[unleashed.git] / usr / src / lib / libbsm / common / getfaudflgs.c
blobe0b3f490fac91dd957f20c8d3eefcca0614f7ff3
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
22 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
25 #include <sys/types.h>
26 #include <bsm/audit.h>
27 #include <bsm/libbsm.h>
30 * getfauditflags() - combines system event flag mask with user event
31 * flag masks.
33 * input: usremasks->as_success - always audit on success
34 * usremasks->as_failure - always audit on failure
35 * usrdmasks->as_success - never audit on success
36 * usrdmasks->as_failure - never audit on failure
38 * output: lastmasks->as_success - audit on success
39 * lastmasks->as_failure - audit on failure
41 * returns: 0 - ok
42 * -1 - error (cannot get attributable mask)
44 int
45 getfauditflags(au_mask_t *usremasks, au_mask_t *usrdmasks, au_mask_t *lastmasks)
47 au_mask_t masks;
49 /* get system audit mask and convert to bit mask */
50 if (auditon(A_GETAMASK, (caddr_t)&masks, sizeof (masks)) == -1) {
51 return (-1);
54 /* combine system and user event masks */
55 lastmasks->as_success = masks.as_success;
56 lastmasks->as_failure = masks.as_failure;
58 lastmasks->as_success |= usremasks->as_success;
59 lastmasks->as_failure |= usremasks->as_failure;
61 lastmasks->as_success &= ~(usrdmasks->as_success);
62 lastmasks->as_failure &= ~(usrdmasks->as_failure);
64 return (0);