Skip to content

Commit

Permalink
SELinuxTypeEnforcement: new parser
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Jan 8, 2025
1 parent 3fd32e8 commit 21520b8
Show file tree
Hide file tree
Showing 15 changed files with 369 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Tmain/list-map-extensions.d/stdout-expected.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## all|grep LdScript
#LANGUAGE EXTENSION
LdScript lds
LdScript scr
LdScript ld
LdScript ldi
#LANGUAGE EXTENSION
LdScript lds
LdScript scr
LdScript ld
LdScript ldi
## LdScript
#EXTENSION
lds
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--sort=no
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bind input.te /^module bind 1.0.0;$/;" m
bootloader input-0.te /^policy_module(bootloader, 1.14.0)$/;" m
2 changes: 2 additions & 0 deletions Units/parser-selinux-type-enforcement.r/modules.d/input-0.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# selinux-policy-0113b35519369e628e7fcd87af000cfcd4b1fa6c/policy/modules/admin/bootloader.te
policy_module(bootloader, 1.14.0)
2 changes: 2 additions & 0 deletions Units/parser-selinux-type-enforcement.r/modules.d/input.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://github.com/SELinuxProject/selinux-notebook/blob/main/src/modular_policy_statements.md#modular-policy-support-statements
module bind 1.0.0;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--sort=no
26 changes: 26 additions & 0 deletions Units/parser-selinux-type-enforcement.r/simple.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
dbus input.te /^policy_module(dbus, 1.19.0)$/;" m
dbusd_unconfined input.te /^attribute dbusd_unconfined;$/;" T
system_bus_type input.te /^attribute system_bus_type;$/;" T
dbusd_etc_t input.te /^type dbusd_etc_t;$/;" t
dbusd_exec_t input.te /^type dbusd_exec_t;$/;" t
system_dbusd_exec_t input.te /^typealias dbusd_exec_t alias system_dbusd_exec_t;$/;" a
session_dbusd_tmp_t input.te /^type session_dbusd_tmp_t;$/;" t
user_dbusd_tmp_t input.te /^typealias session_dbusd_tmp_t alias { user_dbusd_tmp_t staff_dbusd_tmp_t sysadm_dbusd_tmp_t };$/;" a
staff_dbusd_tmp_t input.te /^typealias session_dbusd_tmp_t alias { user_dbusd_tmp_t staff_dbusd_tmp_t sysadm_dbusd_tmp_t };$/;" a
sysadm_dbusd_tmp_t input.te /^typealias session_dbusd_tmp_t alias { user_dbusd_tmp_t staff_dbusd_tmp_t sysadm_dbusd_tmp_t };$/;" a
auditadm_dbusd_tmp_t input.te /^typealias session_dbusd_tmp_t alias { auditadm_dbusd_tmp_t secadm_dbusd_tmp_t };$/;" a
secadm_dbusd_tmp_t input.te /^typealias session_dbusd_tmp_t alias { auditadm_dbusd_tmp_t secadm_dbusd_tmp_t };$/;" a
system_r input.te /^role system_r types system_bus_type;$/;" r
git_sys_content_t input.te /^type git_sys_content_t alias git_system_content_t;$/;" t
git_system_content_t input.te /^type git_sys_content_t alias git_system_content_t;$/;" a
kmod_t input.te /^type kmod_t alias { update_modules_t depmod_t insmod_t };$/;" t
update_modules_t input.te /^type kmod_t alias { update_modules_t depmod_t insmod_t };$/;" a
depmod_t input.te /^type kmod_t alias { update_modules_t depmod_t insmod_t };$/;" a
insmod_t input.te /^type kmod_t alias { update_modules_t depmod_t insmod_t };$/;" a
system_r input.te /^role system_r types anaconda_t;$/;" r
install_roles input.te /^attribute_role install_roles;$/;" R
antivirus_can_scan_system input.te /^gen_tunable(antivirus_can_scan_system, false)$/;" b
secure_mode_insmod input.te /^gen_bool(secure_mode_insmod, false)$/;" b
allow_daemons_use_tty input.te /^bool allow_daemons_use_tty true;$/;" b
xguest_u input.te /^gen_user(xguest_u, user, xguest_r, s0, s0)$/;" u
sysadm_u input.te /^user sysadm_u roles { sysadm_r } level s0 range s0-s15:c0.c255;$/;" u
58 changes: 58 additions & 0 deletions Units/parser-selinux-type-enforcement.r/simple.d/input.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Derrived from policy/modules/contrib/dbus.te
#
policy_module(dbus, 1.19.0)

gen_require(`
class dbus all_dbus_perms;
')

##############################
#
# Delcarations
#

attribute dbusd_unconfined;
attribute system_bus_type;

type dbusd_etc_t;
files_config_file(dbusd_etc_t)

type dbusd_exec_t;
corecmd_executable_file(dbusd_exec_t)
typealias dbusd_exec_t alias system_dbusd_exec_t;

type session_dbusd_tmp_t;
typealias session_dbusd_tmp_t alias { user_dbusd_tmp_t staff_dbusd_tmp_t sysadm_dbusd_tmp_t };
typealias session_dbusd_tmp_t alias { auditadm_dbusd_tmp_t secadm_dbusd_tmp_t };
userdom_user_tmp_file(session_dbusd_tmp_t)

# ...

########################################
#
# system_bus_type rules
#
role system_r types system_bus_type;
dontaudit system_bus_type self:capability net_admin;

# The next one should not be tagged.
gen_require(`
type ssh_keygen_t;
')


type git_sys_content_t alias git_system_content_t;
type kmod_t alias { update_modules_t depmod_t insmod_t };

role system_r types anaconda_t;
attribute_role install_roles;
roleattribute system_r install_roles;

gen_tunable(antivirus_can_scan_system, false)
gen_bool(secure_mode_insmod, false)

bool allow_daemons_use_tty true;

gen_user(xguest_u, user, xguest_r, s0, s0)
user sysadm_u roles { sysadm_r } level s0 range s0-s15:c0.c255;
1 change: 1 addition & 0 deletions docs/news/HEAD.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ New parsers
* TOML *peg/packcc*
* Cargo *TOML based subparser*
* SELinuxIntefae *M4 based subparser*
* SELinuxTypeEnforcement *optlib*

Changes about parser specific kinds, roles, fields, and extras
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions main/parsers_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
SchemeParser, \
SCSSParser, \
SELinuxInterfaceParser, \
SELinuxTypeEnforcementParser, \
ShParser, \
SlangParser, \
SmlParser, \
Expand Down
177 changes: 177 additions & 0 deletions optlib/selinux-type-enforcement.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
/*
* Generated by ./misc/optlib2c from optlib/selinux-type-enforcement.ctags, Don't edit this manually.
*/
#include "general.h"
#include "parse.h"
#include "routines.h"
#include "field.h"
#include "xtag.h"


static void initializeSELinuxTypeEnforcementParser (const langType language)

Check warning on line 11 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L11

Added line #L11 was not covered by tests
{

addLanguageRegexTable (language, "main");
addLanguageRegexTable (language, "typedef");
addLanguageRegexTable (language, "alias");
addLanguageRegexTable (language, "compoundalias");
addLanguageRegexTable (language, "lit");

Check warning on line 18 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L14-L18

Added lines #L14 - L18 were not covered by tests

addLanguageTagMultiTableRegex (language, "main",

Check warning on line 20 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L20

Added line #L20 was not covered by tests
"^#[^\n]*",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 23 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L23

Added line #L23 was not covered by tests
"^[[:space:]]+",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 26 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L26

Added line #L26 was not covered by tests
"^`",
"", "", "{tenter=lit}", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 29 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L29

Added line #L29 was not covered by tests
"^[^pmtarbgu[:space:]][a-zA-Z0-9_]*",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 32 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L32

Added line #L32 was not covered by tests
"^policy_module\\([[:blank:]]*([^,[:space:]\\)]+)[^\\)]*\\)",
"\\1", "m", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 35 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L35

Added line #L35 was not covered by tests
"^module[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
"\\1", "m", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 38 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L38

Added line #L38 was not covered by tests
"^type[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*",
"\\1", "t", "{tenter=typedef}", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 41 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L41

Added line #L41 was not covered by tests
"^typealias[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*",
"", "", "{tenter=typedef}", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 44 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L44

Added line #L44 was not covered by tests
"^attribute[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
"\\1", "T", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 47 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L47

Added line #L47 was not covered by tests
"^role[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
"\\1", "r", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 50 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L50

Added line #L50 was not covered by tests
"^attribute_role[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
"\\1", "R", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 53 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L53

Added line #L53 was not covered by tests
"^bool[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
"\\1", "b", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 56 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L56

Added line #L56 was not covered by tests
"^gen_(tunable|bool)\\([[:blank:]]*([^,[:space:]\\)]+)[^\\)]*\\)",
"\\2", "b", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 59 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L59

Added line #L59 was not covered by tests
"^user[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;",
"\\1", "u", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 62 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L62

Added line #L62 was not covered by tests
"^gen_user\\([[:blank:]]*([^,[:space:]\\)]+)[^\\)]*\\)",
"\\1", "u", "", NULL);
addLanguageTagMultiTableRegex (language, "main",

Check warning on line 65 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L65

Added line #L65 was not covered by tests
"^.",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "typedef",

Check warning on line 68 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L68

Added line #L68 was not covered by tests
"^[[:space:]]+",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "typedef",

Check warning on line 71 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L71

Added line #L71 was not covered by tests
"^alias[[:space:]]+",
"", "", "{tenter=alias}", NULL);
addLanguageTagMultiTableRegex (language, "typedef",

Check warning on line 74 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L74

Added line #L74 was not covered by tests
"^;",
"", "", "{tleave}", NULL);
addLanguageTagMultiTableRegex (language, "typedef",

Check warning on line 77 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L77

Added line #L77 was not covered by tests
"^.",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "alias",

Check warning on line 80 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L80

Added line #L80 was not covered by tests
"^[[:space:]]+",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "alias",

Check warning on line 83 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L83

Added line #L83 was not covered by tests
"^([a-zA-Z0-9_]+)[[:space:]]*",
"\\1", "a", "{tleave}", NULL);
addLanguageTagMultiTableRegex (language, "alias",

Check warning on line 86 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L86

Added line #L86 was not covered by tests
"^\\{[[:space:]]*",
"", "", "{tenter=compoundalias}", NULL);
addLanguageTagMultiTableRegex (language, "alias",

Check warning on line 89 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L89

Added line #L89 was not covered by tests
"^\\}[[:space:]]*",
"", "", "{tleave}", NULL);
addLanguageTagMultiTableRegex (language, "alias",

Check warning on line 92 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L92

Added line #L92 was not covered by tests
"^.",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "compoundalias",

Check warning on line 95 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L95

Added line #L95 was not covered by tests
"^[[:space:]]+",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "compoundalias",

Check warning on line 98 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L98

Added line #L98 was not covered by tests
"^([a-zA-Z0-9_]+)[[:space:]]*",
"\\1", "a", "", NULL);
addLanguageTagMultiTableRegex (language, "compoundalias",

Check warning on line 101 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L101

Added line #L101 was not covered by tests
"^\\}[[:space:]]*",
"", "", "{tleave}{_advanceTo=0start}", NULL);
addLanguageTagMultiTableRegex (language, "compoundalias",

Check warning on line 104 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L104

Added line #L104 was not covered by tests
"^.",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "lit",

Check warning on line 107 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L107

Added line #L107 was not covered by tests
"^[^'`]+",
"", "", "", NULL);
addLanguageTagMultiTableRegex (language, "lit",

Check warning on line 110 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L110

Added line #L110 was not covered by tests
"^'",
"", "", "{tleave}", NULL);
addLanguageTagMultiTableRegex (language, "lit",

Check warning on line 113 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L113

Added line #L113 was not covered by tests
"^`",
"", "", "{tenter=lit}", NULL);
addLanguageTagMultiTableRegex (language, "lit",

Check warning on line 116 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L116

Added line #L116 was not covered by tests
"^.",
"", "", "", NULL);
}

Check warning on line 119 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L119

Added line #L119 was not covered by tests

extern parserDefinition* SELinuxTypeEnforcementParser (void)

Check warning on line 121 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L121

Added line #L121 was not covered by tests
{
static const char *const extensions [] = {

Check warning on line 123 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L123

Added line #L123 was not covered by tests
"te",
NULL
};

static const char *const aliases [] = {

Check warning on line 128 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L128

Added line #L128 was not covered by tests
NULL
};

static const char *const patterns [] = {

Check warning on line 132 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L132

Added line #L132 was not covered by tests
NULL
};

static kindDefinition SELinuxTypeEnforcementKindTable [] = {

Check warning on line 136 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L136

Added line #L136 was not covered by tests
{
true, 'm', "module", "policy modules",
},
{
true, 't', "type", "types",
},
{
true, 'a', "alias", "type aliases",
},
{
true, 'T', "attr", "type attributes",
},
{
true, 'r', "role", "roles",
},
{
true, 'R', "rattr", "role attributes",
},
{
true, 'b', "tunable", "tunables",
},
{
true, 'u', "user", "users",
},
};

parserDefinition* const def = parserNew ("SELinuxTypeEnforcement");

Check warning on line 163 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L163

Added line #L163 was not covered by tests

def->versionCurrent= 0;
def->versionAge = 0;
def->enabled = true;
def->extensions = extensions;
def->patterns = patterns;
def->aliases = aliases;
def->method = METHOD_NOT_CRAFTED|METHOD_REGEX;
def->kindTable = SELinuxTypeEnforcementKindTable;
def->kindCount = ARRAY_SIZE(SELinuxTypeEnforcementKindTable);
def->initialize = initializeSELinuxTypeEnforcementParser;

Check warning on line 174 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L165-L174

Added lines #L165 - L174 were not covered by tests

return def;

Check warning on line 176 in optlib/selinux-type-enforcement.c

View check run for this annotation

Codecov / codecov/patch

optlib/selinux-type-enforcement.c#L176

Added line #L176 was not covered by tests
}
88 changes: 88 additions & 0 deletions optlib/selinux-type-enforcement.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#
# Copyright (c) 2025 Red Hat, Inc.
# Copyright (c) 2025 Masatake YAMATO
#
# This source code is released for free distribution under the terms of the
# GNU General Public License version 2 or (at your opinion) any later version.
#
# This module contains functions for generating tags for *.te files in SELinux policy definitions:
#
# https://github.com/SELinuxProject/selinux-notebook/blob/main/src/kernel_policy_language.md#kernel-policy-language
#
--langdef=SELinuxTypeEnforcement
--map-SELinuxTypeEnforcement=+.te

--kinddef-SELinuxTypeEnforcement=m,module,policy modules
--kinddef-SELinuxTypeEnforcement=t,type,types
--kinddef-SELinuxTypeEnforcement=a,alias,type aliases
--kinddef-SELinuxTypeEnforcement=T,attr,type attributes
--kinddef-SELinuxTypeEnforcement=r,role,roles
--kinddef-SELinuxTypeEnforcement=R,rattr,role attributes
--kinddef-SELinuxTypeEnforcement=b,tunable,tunables
--kinddef-SELinuxTypeEnforcement=u,user,users
# TODO: sensitivity, category, sid, class

--_tabledef-SELinuxTypeEnforcement=main
--_tabledef-SELinuxTypeEnforcement=typedef
--_tabledef-SELinuxTypeEnforcement=alias
--_tabledef-SELinuxTypeEnforcement=compoundalias
--_tabledef-SELinuxTypeEnforcement=lit

#
# main
#
--_mtable-regex-SELinuxTypeEnforcement=main/#[^\n]*//
--_mtable-regex-SELinuxTypeEnforcement=main/[[:space:]]+//
--_mtable-regex-SELinuxTypeEnforcement=main/`//{tenter=lit}
--_mtable-regex-SELinuxTypeEnforcement=main/[^pmtarbgu[:space:]][a-zA-Z0-9_]*//

--_mtable-regex-SELinuxTypeEnforcement=main/policy_module\([[:blank:]]*([^,[:space:]\)]+)[^\)]*\)/\1/m/
--_mtable-regex-SELinuxTypeEnforcement=main/module[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;/\1/m/

--_mtable-regex-SELinuxTypeEnforcement=main/type[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*/\1/t/{tenter=typedef}
--_mtable-regex-SELinuxTypeEnforcement=main/typealias[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*//{tenter=typedef}
--_mtable-regex-SELinuxTypeEnforcement=main/attribute[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;/\1/T/

--_mtable-regex-SELinuxTypeEnforcement=main/role[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;/\1/r/
--_mtable-regex-SELinuxTypeEnforcement=main/attribute_role[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;/\1/R/

--_mtable-regex-SELinuxTypeEnforcement=main/bool[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;/\1/b/
--_mtable-regex-SELinuxTypeEnforcement=main/gen_(tunable|bool)\([[:blank:]]*([^,[:space:]\)]+)[^\)]*\)/\2/b/

--_mtable-regex-SELinuxTypeEnforcement=main/user[[:blank:]]+([a-zA-Z0-9_]+)[[:blank:]]*[^;]*;/\1/u/
--_mtable-regex-SELinuxTypeEnforcement=main/gen_user\([[:blank:]]*([^,[:space:]\)]+)[^\)]*\)/\1/u/

--_mtable-regex-SELinuxTypeEnforcement=main/.//

#
# typedef
#
--_mtable-regex-SELinuxTypeEnforcement=typedef/[[:space:]]+//
--_mtable-regex-SELinuxTypeEnforcement=typedef/alias[[:space:]]+//{tenter=alias}
--_mtable-regex-SELinuxTypeEnforcement=typedef/;//{tleave}
--_mtable-regex-SELinuxTypeEnforcement=typedef/.//

#
# alias
#
--_mtable-regex-SELinuxTypeEnforcement=alias/[[:space:]]+//
--_mtable-regex-SELinuxTypeEnforcement=alias/([a-zA-Z0-9_]+)[[:space:]]*/\1/a/{tleave}
--_mtable-regex-SELinuxTypeEnforcement=alias/\{[[:space:]]*//{tenter=compoundalias}
--_mtable-regex-SELinuxTypeEnforcement=alias/\}[[:space:]]*//{tleave}
--_mtable-regex-SELinuxTypeEnforcement=alias/.//

#
# compoundalias
#
--_mtable-regex-SELinuxTypeEnforcement=compoundalias/[[:space:]]+//
--_mtable-regex-SELinuxTypeEnforcement=compoundalias/([a-zA-Z0-9_]+)[[:space:]]*/\1/a/
--_mtable-regex-SELinuxTypeEnforcement=compoundalias/\}[[:space:]]*//{tleave}{_advanceTo=0start}
--_mtable-regex-SELinuxTypeEnforcement=compoundalias/.//

#
# lit
#
--_mtable-regex-SELinuxTypeEnforcement=lit/[^'`]+//
--_mtable-regex-SELinuxTypeEnforcement=lit/'//{tleave}
--_mtable-regex-SELinuxTypeEnforcement=lit/`//{tenter=lit}
--_mtable-regex-SELinuxTypeEnforcement=lit/.//
Loading

0 comments on commit 21520b8

Please sign in to comment.