2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: add permission merging

By changing the compare function from each rule to use class_rule_t,
instead of perms_rule_t, we temporarily ignore if permissions are
different. If every rule attribute is the same, then the permissions
can be merged. This is done at the perms_rule_t's level.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
Georgia Garcia
2023-07-10 17:58:08 -03:00
parent 1279f85e4a
commit cdb5e501d6
9 changed files with 24 additions and 8 deletions

View File

@@ -55,7 +55,8 @@ public:
virtual bool is_mergeable(void) { return true; }
virtual int cmp(rule_t const &rhs) const
{
int res = perms_rule_t::cmp(rhs);
/* use class_rule_t instead of perms_rule_t to merge perms */
int res = class_rule_t::cmp(rhs);
if (res)
return res;
return null_strcmp(peer_label,