xref: /illumos-gate/usr/src/uts/common/sys/tsol/priv.h (revision 2d6eb4a5)
1*45916cd2Sjpk /*
2*45916cd2Sjpk  * CDDL HEADER START
3*45916cd2Sjpk  *
4*45916cd2Sjpk  * The contents of this file are subject to the terms of the
5*45916cd2Sjpk  * Common Development and Distribution License (the "License").
6*45916cd2Sjpk  * You may not use this file except in compliance with the License.
7*45916cd2Sjpk  *
8*45916cd2Sjpk  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*45916cd2Sjpk  * or http://www.opensolaris.org/os/licensing.
10*45916cd2Sjpk  * See the License for the specific language governing permissions
11*45916cd2Sjpk  * and limitations under the License.
12*45916cd2Sjpk  *
13*45916cd2Sjpk  * When distributing Covered Code, include this CDDL HEADER in each
14*45916cd2Sjpk  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*45916cd2Sjpk  * If applicable, add the following below this CDDL HEADER, with the
16*45916cd2Sjpk  * fields enclosed by brackets "[]" replaced with your own identifying
17*45916cd2Sjpk  * information: Portions Copyright [yyyy] [name of copyright owner]
18*45916cd2Sjpk  *
19*45916cd2Sjpk  * CDDL HEADER END
20*45916cd2Sjpk  */
21*45916cd2Sjpk /*
22*45916cd2Sjpk  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*45916cd2Sjpk  * Use is subject to license terms.
24*45916cd2Sjpk  */
25*45916cd2Sjpk 
26*45916cd2Sjpk #ifndef	_SYS_TSOL_PRIV_H
27*45916cd2Sjpk #define	_SYS_TSOL_PRIV_H
28*45916cd2Sjpk 
29*45916cd2Sjpk #include <sys/priv.h>
30*45916cd2Sjpk 
31*45916cd2Sjpk #ifdef	__cplusplus
32*45916cd2Sjpk extern "C" {
33*45916cd2Sjpk #endif
34*45916cd2Sjpk 
35*45916cd2Sjpk typedef enum priv_ftype {
36*45916cd2Sjpk 	PRIV_ALLOWED,
37*45916cd2Sjpk 	PRIV_FORCED
38*45916cd2Sjpk } priv_ftype_t;
39*45916cd2Sjpk 
40*45916cd2Sjpk /*
41*45916cd2Sjpk  * Privilege macros.
42*45916cd2Sjpk  */
43*45916cd2Sjpk 
44*45916cd2Sjpk /*
45*45916cd2Sjpk  * PRIV_ASSERT(a, b) setst.privilege "b" in privilege set "a".
46*45916cd2Sjpk  */
47*45916cd2Sjpk #define	PRIV_ASSERT(a, b) (priv_addset(a, b))
48*45916cd2Sjpk 
49*45916cd2Sjpk /*
50*45916cd2Sjpk  * PRIV_CLEAR(a,b) clearst.privilege "b" in privilege set "a".
51*45916cd2Sjpk  */
52*45916cd2Sjpk #define	PRIV_CLEAR(a, b) (priv_delset(a, b))
53*45916cd2Sjpk 
54*45916cd2Sjpk /*
55*45916cd2Sjpk  * PRIV_EQUAL(set_a, set_b) is true if set_a and set_b are identical.
56*45916cd2Sjpk  */
57*45916cd2Sjpk #define	PRIV_EQUAL(a, b) (priv_isequalset(a, b))
58*45916cd2Sjpk #define	PRIV_EMPTY(a) (priv_emptyset(a))
59*45916cd2Sjpk #define	PRIV_FILL(a) (priv_fillset(a))
60*45916cd2Sjpk 
61*45916cd2Sjpk /*
62*45916cd2Sjpk  * PRIV_ISASSERT tests if privilege 'b' is asserted in privilege set 'a'.
63*45916cd2Sjpk  */
64*45916cd2Sjpk #define	PRIV_ISASSERT(a, b) (priv_ismember(a, b))
65*45916cd2Sjpk #define	PRIV_ISEMPTY(a) (priv_isemptyset(a))
66*45916cd2Sjpk #define	PRIV_ISFULL(a) (priv_isfullset(a))
67*45916cd2Sjpk 
68*45916cd2Sjpk /*
69*45916cd2Sjpk  * This macro returns 1 if all privileges asserted in privilege set "a"
70*45916cd2Sjpk  * are also asserted in privilege set "b" (i.e. if a is a subset of b)
71*45916cd2Sjpk  */
72*45916cd2Sjpk #define	PRIV_ISSUBSET(a, b) (priv_issubset(a, b))
73*45916cd2Sjpk 
74*45916cd2Sjpk /*
75*45916cd2Sjpk  * Takes intersection of "a" and "b" and stores in "b".
76*45916cd2Sjpk  */
77*45916cd2Sjpk #define	PRIV_INTERSECT(a, b) (priv_intersect(a, b))
78*45916cd2Sjpk 
79*45916cd2Sjpk /*
80*45916cd2Sjpk  * Replaces "a" with inverse of "a".
81*45916cd2Sjpk  */
82*45916cd2Sjpk #define	PRIV_INVERSE(a)  (priv_inverse(a))
83*45916cd2Sjpk 
84*45916cd2Sjpk /*
85*45916cd2Sjpk  * Takes union of "a" and "b" and stores in "b".
86*45916cd2Sjpk  */
87*45916cd2Sjpk #define	PRIV_UNION(a, b) (priv_union(a, b))
88*45916cd2Sjpk 
89*45916cd2Sjpk 
90*45916cd2Sjpk #define	PRIV_FILE_UPGRADE_SL	((const char *)"file_upgrade_sl")
91*45916cd2Sjpk #define	PRIV_FILE_DOWNGRADE_SL	((const char *)"file_downgrade_sl")
92*45916cd2Sjpk #
93*45916cd2Sjpk #define	PRIV_PROC_AUDIT_TCB	((const char *)"proc_audit")
94*45916cd2Sjpk #define	PRIV_PROC_AUDIT_APPL	((const char *)"proc_audit")
95*45916cd2Sjpk #
96*45916cd2Sjpk #define	PRIV_SYS_TRANS_LABEL	((const char *)"sys_trans_label")
97*45916cd2Sjpk #define	PRIV_WIN_COLORMAP	((const char *)"win_colormap")
98*45916cd2Sjpk #define	PRIV_WIN_CONFIG		((const char *)"win_config")
99*45916cd2Sjpk #define	PRIV_WIN_DAC_READ	((const char *)"win_dac_read")
100*45916cd2Sjpk #define	PRIV_WIN_DAC_WRITE	((const char *)"win_dac_write")
101*45916cd2Sjpk #define	PRIV_WIN_DGA		((const char *)"win_dga")
102*45916cd2Sjpk #define	PRIV_WIN_DEVICES	((const char *)"win_devices")
103*45916cd2Sjpk #define	PRIV_WIN_DOWNGRADE_SL	((const char *)"win_downgrade_sl")
104*45916cd2Sjpk #define	PRIV_WIN_FONTPATH	((const char *)"win_fontpath")
105*45916cd2Sjpk #define	PRIV_WIN_MAC_READ	((const char *)"win_mac_read")
106*45916cd2Sjpk #define	PRIV_WIN_MAC_WRITE	((const char *)"win_mac_write")
107*45916cd2Sjpk #define	PRIV_WIN_SELECTION	((const char *)"win_selection")
108*45916cd2Sjpk #define	PRIV_WIN_UPGRADE_SL	((const char *)"win_upgrade_sl")
109*45916cd2Sjpk 
110*45916cd2Sjpk #ifdef	__cplusplus
111*45916cd2Sjpk }
112*45916cd2Sjpk #endif
113*45916cd2Sjpk 
114*45916cd2Sjpk #endif	/* _SYS_TSOL_PRIV_H */
115