mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 14:25:52 +00:00
parser: enable variable expansion for mount type= and options=
Currently mount options type= and options= do not expand variables
but they should. Fix it.
Note: this does not treat either as paths because their use is
too device dependent for it to be safe to filter slashes.
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/99
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/638
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 882380ad3d
)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
@@ -486,6 +486,7 @@ ostream &mnt_rule::dump(ostream &os)
|
||||
/* does not currently support expansion of vars in options */
|
||||
int mnt_rule::expand_variables(void)
|
||||
{
|
||||
struct value_list *ent;
|
||||
int error = 0;
|
||||
|
||||
error = expand_entry_variables(&mnt_point);
|
||||
@@ -498,6 +499,17 @@ int mnt_rule::expand_variables(void)
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
list_for_each(dev_type, ent) {
|
||||
error = expand_entry_variables(&ent->value);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
list_for_each(opts, ent) {
|
||||
error = expand_entry_variables(&ent->value);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user