xref: /illumos-gate/usr/src/uts/common/sys/tsol/priv.h (revision 2d6eb4a5e0a47d30189497241345dc5466bb68ab)
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 #ifndef	_SYS_TSOL_PRIV_H
27 #define	_SYS_TSOL_PRIV_H
28 
29 #include <sys/priv.h>
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 typedef enum priv_ftype {
36 	PRIV_ALLOWED,
37 	PRIV_FORCED
38 } priv_ftype_t;
39 
40 /*
41  * Privilege macros.
42  */
43 
44 /*
45  * PRIV_ASSERT(a, b) setst.privilege "b" in privilege set "a".
46  */
47 #define	PRIV_ASSERT(a, b) (priv_addset(a, b))
48 
49 /*
50  * PRIV_CLEAR(a,b) clearst.privilege "b" in privilege set "a".
51  */
52 #define	PRIV_CLEAR(a, b) (priv_delset(a, b))
53 
54 /*
55  * PRIV_EQUAL(set_a, set_b) is true if set_a and set_b are identical.
56  */
57 #define	PRIV_EQUAL(a, b) (priv_isequalset(a, b))
58 #define	PRIV_EMPTY(a) (priv_emptyset(a))
59 #define	PRIV_FILL(a) (priv_fillset(a))
60 
61 /*
62  * PRIV_ISASSERT tests if privilege 'b' is asserted in privilege set 'a'.
63  */
64 #define	PRIV_ISASSERT(a, b) (priv_ismember(a, b))
65 #define	PRIV_ISEMPTY(a) (priv_isemptyset(a))
66 #define	PRIV_ISFULL(a) (priv_isfullset(a))
67 
68 /*
69  * This macro returns 1 if all privileges asserted in privilege set "a"
70  * are also asserted in privilege set "b" (i.e. if a is a subset of b)
71  */
72 #define	PRIV_ISSUBSET(a, b) (priv_issubset(a, b))
73 
74 /*
75  * Takes intersection of "a" and "b" and stores in "b".
76  */
77 #define	PRIV_INTERSECT(a, b) (priv_intersect(a, b))
78 
79 /*
80  * Replaces "a" with inverse of "a".
81  */
82 #define	PRIV_INVERSE(a)  (priv_inverse(a))
83 
84 /*
85  * Takes union of "a" and "b" and stores in "b".
86  */
87 #define	PRIV_UNION(a, b) (priv_union(a, b))
88 
89 
90 #define	PRIV_FILE_UPGRADE_SL	((const char *)"file_upgrade_sl")
91 #define	PRIV_FILE_DOWNGRADE_SL	((const char *)"file_downgrade_sl")
92 #
93 #define	PRIV_PROC_AUDIT_TCB	((const char *)"proc_audit")
94 #define	PRIV_PROC_AUDIT_APPL	((const char *)"proc_audit")
95 #
96 #define	PRIV_SYS_TRANS_LABEL	((const char *)"sys_trans_label")
97 #define	PRIV_WIN_COLORMAP	((const char *)"win_colormap")
98 #define	PRIV_WIN_CONFIG		((const char *)"win_config")
99 #define	PRIV_WIN_DAC_READ	((const char *)"win_dac_read")
100 #define	PRIV_WIN_DAC_WRITE	((const char *)"win_dac_write")
101 #define	PRIV_WIN_DGA		((const char *)"win_dga")
102 #define	PRIV_WIN_DEVICES	((const char *)"win_devices")
103 #define	PRIV_WIN_DOWNGRADE_SL	((const char *)"win_downgrade_sl")
104 #define	PRIV_WIN_FONTPATH	((const char *)"win_fontpath")
105 #define	PRIV_WIN_MAC_READ	((const char *)"win_mac_read")
106 #define	PRIV_WIN_MAC_WRITE	((const char *)"win_mac_write")
107 #define	PRIV_WIN_SELECTION	((const char *)"win_selection")
108 #define	PRIV_WIN_UPGRADE_SL	((const char *)"win_upgrade_sl")
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif	/* _SYS_TSOL_PRIV_H */
115