[apparmor] [PATCH 18/20] Refactor change_profile to bring ns and none ns target into one rule

John Johansen john.johansen at canonical.com
Fri May 29 08:39:24 UTC 2015


Signed-off-by: John Johansen <john.johansen at canonical.com>
---
 parser/parser_yacc.y | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/parser/parser_yacc.y b/parser/parser_yacc.y
index 8d90332..b3083d5 100644
--- a/parser/parser_yacc.y
+++ b/parser/parser_yacc.y
@@ -1516,21 +1516,10 @@ change_profile: change_profile_head TOK_END_OF_RULE
 		$$ = 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;
-		PDEBUG("Matched change_profile: tok_id (%s)\n", $3);
-		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);
+		PDEBUG("Matched change_profile: tok_id (:%s://%s)\n", $3 ? $3 : "", $4);
 		entry = new_entry($3, $4, AA_CHANGE_PROFILE, $1);
 		if (!entry)
 			yyerror(_("Memory allocation error."));
@@ -1538,7 +1527,6 @@ change_profile:	change_profile_head TOK_ARROW ns_id TOK_ID TOK_END_OF_RULE
 		$$ = entry;
 	};
 
-
 capability:	TOK_CAPABILITY caps TOK_END_OF_RULE
 	{
 		if ($2 == 0) {
-- 
2.1.4




More information about the AppArmor mailing list