mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 18:17:09 +00:00
Merge Improve error message for unknown mount options
Parsing `mount options=x` results in "Passed unknown options keyword to MountRule: x", while parsing `mount options=xy` results in "Can't parse mount rule". This difference happens because the code checks (besides the list of known options) for a regex `([A-Za-z0-9])` which only matched a single-character unknown option. Change that regex to also match multiple characters, and also allow to match `-` (used in some known mount options, so it's likely that it also gets used in so far unknown mount options) MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1710 Approved-by: Georgia Garcia <georgia.garcia@canonical.com> Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
commit
1009a66e0c
@ -37,7 +37,8 @@ flags_keywords = list(flags_bind_mount) + list(flags_change_propagation) + [
|
|||||||
'ro', 'read-only', 'rw', 'suid', 'nosuid', 'dev', 'nodev', 'exec', 'noexec', 'sync', 'async', 'mand',
|
'ro', 'read-only', 'rw', 'suid', 'nosuid', 'dev', 'nodev', 'exec', 'noexec', 'sync', 'async', 'mand',
|
||||||
'nomand', 'dirsync', 'symfollow', 'nosymfollow', 'atime', 'noatime', 'diratime', 'nodiratime', 'move', 'M',
|
'nomand', 'dirsync', 'symfollow', 'nosymfollow', 'atime', 'noatime', 'diratime', 'nodiratime', 'move', 'M',
|
||||||
'verbose', 'silent', 'loud', 'acl', 'noacl', 'relatime', 'norelatime', 'iversion', 'noiversion', 'strictatime',
|
'verbose', 'silent', 'loud', 'acl', 'noacl', 'relatime', 'norelatime', 'iversion', 'noiversion', 'strictatime',
|
||||||
'nostrictatime', 'lazytime', 'nolazytime', 'user', 'nouser', 'r', 'w', '([A-Za-z0-9])',
|
'nostrictatime', 'lazytime', 'nolazytime', 'user', 'nouser', 'r', 'w',
|
||||||
|
'[A-Za-z0-9-]+', # as long as the parser uses a hardcoded options list, this only helps to print a better error message on unknown mount options
|
||||||
]
|
]
|
||||||
join_valid_flags = '|'.join(flags_keywords)
|
join_valid_flags = '|'.join(flags_keywords)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user