mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 01:57:43 +00:00
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)
This commit is contained in:
parent
23deb55149
commit
9a035cb0ee
@ -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',
|
||||
'nomand', 'dirsync', 'symfollow', 'nosymfollow', 'atime', 'noatime', 'diratime', 'nodiratime', 'move', 'M',
|
||||
'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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user