File: misc_macros.spt

package info (click to toggle)
refpolicy 0.0.20061018-5
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 7,488 kB
  • ctags: 415
  • sloc: xml: 55,156; python: 1,867; makefile: 463; sh: 457; ansic: 290; perl: 171; sed: 14; awk: 7
file content (78 lines) | stat: -rw-r--r-- 1,710 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

########################################
#
# Helper macros
#

#
# shiftn(num,list...)
#
# shift the list num times
#
define(`shiftn',`ifelse($1,0,`shift($*)',`shiftn(decr($1),shift(shift($*)))')')

#
# ifndef(expr,true_block,false_block)
#
# m4 does not have this.
#
define(`ifndef',`ifdef(`$1',`$3',`$2')')

#
# __endline__
#
# dummy macro to insert a newline.  used for 
# errprint, so the close parentheses can be
# indented correctly.
#
define(`__endline__',`
')

########################################
#
# refpolwarn(message)
#
# print a warning message
#
define(`refpolicywarn',`errprint(__file__:__line__: Warning: `$1'__endline__)')

########################################
#
# refpolerr(message)
#
# print an error message.  does not
# make anything fail.
#
define(`refpolicyerr',`errprint(__file__:__line__: Error: `$1'__endline__)')

########################################
#
# gen_user(username, prefix, role_set, mls_defaultlevel, mls_range, [mcs_categories])
#
define(`gen_user',`dnl
ifdef(`users_extra',`dnl
ifelse(`$2',,,`user $1 prefix $2;')
',`dnl
user $1 roles { $3 }`'ifdef(`enable_mls', ` level $4 range $5')`'ifdef(`enable_mcs',` level s0 range s0`'ifelse(`$6',,,` - s0:$6')');
')dnl
')

########################################
#
# gen_context(context,mls_sensitivity,[mcs_categories])
#
define(`gen_context',`$1`'ifdef(`enable_mls',`:$2')`'ifdef(`enable_mcs',`:s0`'ifelse(`$3',,,`:$3')')')dnl

########################################
#
# can_exec(domain,executable)
#
define(`can_exec',`allow $1 $2:file { rx_file_perms execute_no_trans };')

########################################
#
# gen_bool(name,default_value)
#
define(`gen_bool',`
	bool $1 dflt_or_overr(`$1'_conf,$2);
')