2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

Refactor change_profile to bring ns and none ns target into one rule

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
John Johansen
2015-06-12 15:25:10 -07:00
parent 731718971f
commit f364cd7f6f

View File

@@ -1516,21 +1516,10 @@ change_profile: change_profile_head TOK_END_OF_RULE
$$ = entry; $$ = entry;
}; };
change_profile: change_profile_head TOK_ARROW TOK_ID TOK_END_OF_RULE change_profile: change_profile_head TOK_ARROW opt_ns TOK_ID TOK_END_OF_RULE
{ {
struct cod_entry *entry; struct cod_entry *entry;
PDEBUG("Matched change_profile: tok_id (%s)\n", $3); PDEBUG("Matched change_profile: tok_id (:%s://%s)\n", $3 ? $3 : "", $4);
entry = new_entry(NULL, $3, AA_CHANGE_PROFILE, $1);
if (!entry)
yyerror(_("Memory allocation error."));
PDEBUG("change_profile.entry: (%s)\n", entry->name);
$$ = entry;
};
change_profile: change_profile_head TOK_ARROW ns_id TOK_ID TOK_END_OF_RULE
{
struct cod_entry *entry;
PDEBUG("Matched change_profile: tok_id (%s:%s)\n", $3, $4);
entry = new_entry($3, $4, AA_CHANGE_PROFILE, $1); entry = new_entry($3, $4, AA_CHANGE_PROFILE, $1);
if (!entry) if (!entry)
yyerror(_("Memory allocation error.")); yyerror(_("Memory allocation error."));
@@ -1538,7 +1527,6 @@ change_profile: change_profile_head TOK_ARROW ns_id TOK_ID TOK_END_OF_RULE
$$ = entry; $$ = entry;
}; };
capability: TOK_CAPABILITY caps TOK_END_OF_RULE capability: TOK_CAPABILITY caps TOK_END_OF_RULE
{ {
if ($2 == 0) { if ($2 == 0) {