mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
parser: fixup gen_flag_rules
gen_flag_rules has a boolean vs bit and case where parenthesis are helpful to express the intended order of operations. It also doesn't handle the case where there are no matches. Fix this by causing that case to fail. also improve the debug of option extraction. Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
1ec39fd437
commit
f09676f5f9
1 changed files with 4 additions and 3 deletions
|
@ -413,7 +413,8 @@ static struct cond_entry *extract_options(struct cond_entry **conds, int eq)
|
|||
strcmp(entry->name, "option") == 0) &&
|
||||
entry->eq == eq) {
|
||||
list_remove_at(*conds, prev, entry);
|
||||
PDEBUG(" extracting option %s\n", entry->name);
|
||||
PDEBUG(" extracting %s %s\n", entry->name, entry->eq ?
|
||||
"=" : "in");
|
||||
list_append(entry, list);
|
||||
list = entry;
|
||||
} else
|
||||
|
@ -980,12 +981,12 @@ int mnt_rule::gen_flag_rules(Profile &prof, int &count, unsigned int flags,
|
|||
&& !dev_type && !opts) {
|
||||
return gen_policy_move_mount(prof, count, flags, opt_flags);
|
||||
} else if ((allow & AA_MAY_MOUNT) &&
|
||||
(flags | opt_flags) & ~MS_CMDS) {
|
||||
((flags | opt_flags) & ~MS_CMDS)) {
|
||||
/* generic mount if flags are set that are not covered by
|
||||
* above commands
|
||||
*/
|
||||
return gen_policy_new_mount(prof, count, flags, opt_flags);
|
||||
}
|
||||
} /* else must be RULE_OK for some rules */
|
||||
|
||||
return RULE_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue