|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Helper macros
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# shiftn(num,list...)
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# shift the list num times
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
define(`shiftn',`ifelse($1,0,`shift($*)',`shiftn(decr($1),shift(shift($*)))')')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# ifndef(expr,true_block,false_block)
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# m4 does not have this.
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
define(`ifndef',`ifdef(`$1',`$3',`$2')')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# __endline__
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# dummy macro to insert a newline. used for
|
|
Chris PeBenito |
17de1b |
# errprint, so the close parentheses can be
|
|
Chris PeBenito |
17de1b |
# indented correctly.
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
define(`__endline__',`
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
a9e03b |
########################################
|
|
Chris PeBenito |
ea3c1f |
#
|
|
Chris PeBenito |
ea3c1f |
# refpolwarn(message)
|
|
Chris PeBenito |
ea3c1f |
#
|
|
Chris PeBenito |
ea3c1f |
# print a warning message
|
|
Chris PeBenito |
ea3c1f |
#
|
|
Chris PeBenito |
ea3c1f |
define(`refpolicywarn',`errprint(__file__:__line__: Warning: `$1'__endline__)')
|
|
Chris PeBenito |
ea3c1f |
|
|
Chris PeBenito |
a9e03b |
########################################
|
|
Chris PeBenito |
ea3c1f |
#
|
|
Chris PeBenito |
ea3c1f |
# refpolerr(message)
|
|
Chris PeBenito |
ea3c1f |
#
|
|
Chris PeBenito |
ea3c1f |
# print an error message. does not
|
|
Chris PeBenito |
ea3c1f |
# make anything fail.
|
|
Chris PeBenito |
ea3c1f |
#
|
|
Chris PeBenito |
ea3c1f |
define(`refpolicyerr',`errprint(__file__:__line__: Error: `$1'__endline__)')
|
|
Chris PeBenito |
ea3c1f |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# gen_user(username, prefix, role_set, mls_defaultlevel, mls_range, [mcs_categories])
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
define(`gen_user',`dnl
|
|
Chris PeBenito |
17de1b |
ifdef(`users_extra',`dnl
|
|
Chris PeBenito |
17de1b |
ifelse(`$2',,,`user $1 prefix $2;')
|
|
Chris PeBenito |
17de1b |
',`dnl
|
|
Chris PeBenito |
17de1b |
user $1 roles { $3 }`'ifdef(`enable_mls', ` level $4 range $5')`'ifdef(`enable_mcs',` level s0 range s0`'ifelse(`$6',,,` - s0:$6')');
|
|
Chris PeBenito |
17de1b |
')dnl
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# gen_context(context,mls_sensitivity,[mcs_categories])
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
define(`gen_context',`$1`'ifdef(`enable_mls',`:$2')`'ifdef(`enable_mcs',`:s0`'ifelse(`$3',,,`:$3')')')dnl
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# can_exec(domain,executable)
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
define(`can_exec',`allow $1 $2:file { rx_file_perms execute_no_trans };')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# gen_bool(name,default_value)
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
define(`gen_bool',`
|
|
Chris PeBenito |
17de1b |
bool $1 dflt_or_overr(`$1'_conf,$2);
|
|
Chris PeBenito |
17de1b |
')
|