2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-02 23:35:37 +00:00

Store variables in active_profiles (ProfileList)

... instead of filelist[file]['lvar'], and also write them from there.

Also fix detection of variable definitions inside a profile, which is
not allowed.

Note that ProfileList has a different write order than the old code -
first includes, then variable definitions. This makes more sense because
typical profiles first include tunables/global, and then define
additonal variables (that might use variables from tunables/global) or
extend variables defined in tunables/global.

This change also fixes some problems with the simple_test test profiles.
The "adding to non-existing variable" check currently doesn't exist,
which "fixes" lp:1331856.

OTOH this also means that such cases are not detected, therefore add
vars_bad_add_assignment_1.sd to the exception_not_raised list.

The check will be re-added in a later commit
in get_all_merged_variables().
This commit is contained in:
Christian Boltz
2020-05-21 23:31:52 +02:00
parent 2a58e0ada2
commit e5d38807df
3 changed files with 12 additions and 26 deletions

View File

@@ -157,7 +157,7 @@ exception_not_raised = [
'vars/vars_bad_4.sd',
'vars/vars_bad_5.sd',
'vars/vars_bad_7.sd',
'vars/vars_bad_8.sd',
'vars/vars_bad_add_assignment_1.sd', # adding to non-existing variable
'vars/vars_bad_trailing_comma_1.sd',
'vars/vars_bad_trailing_comma_2.sd',
'vars/vars_bad_trailing_comma_3.sd',
@@ -169,7 +169,6 @@ exception_not_raised = [
'vars/vars_dbus_bad_05.sd',
'vars/vars_dbus_bad_06.sd',
'vars/vars_dbus_bad_07.sd',
'vars/vars_file_evaluation_7.sd',
'vars/vars_file_evaluation_8.sd',
# profile name in var doesn't start with /
@@ -391,7 +390,6 @@ syntax_failure = [
# misc
'vars/vars_dbus_8.sd', # Path doesn't start with / or variable: {/@{TLDS}/foo,/com/@{DOMAINS}}
'vars/vars_simple_assignment_12.sd', # Redefining existing variable @{BAR} ('\' not handled)
'rewrite/alias_good_5.sd', # Values added to a non-existing variable @{FOO} (defined in include, lp:1331856)
'bare_include_tests/ok_2.sd', # two #include<...> in one line
]