diff --git a/parser/parser_lex.l b/parser/parser_lex.l index 0456843a0..286d9a291 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -612,7 +612,7 @@ LT_EQUAL <= PUSH_AND_RETURN(state, token); } -{ +{ {END_OF_RULE} { if (YY_START != INITIAL) POP_NODUMP(); diff --git a/parser/parser_yacc.y b/parser/parser_yacc.y index 3ebaed433..ce5715390 100644 --- a/parser/parser_yacc.y +++ b/parser/parser_yacc.y @@ -1481,6 +1481,20 @@ file_mode: TOK_MODE free($1); } +change_profile: TOK_CHANGE_PROFILE TOK_END_OF_RULE + { + struct cod_entry *entry; + char *rule = strdup("**"); + if (!rule) + yyerror(_("Memory allocation error.")); + PDEBUG("Matched change_profile,\n"); + entry = new_entry(NULL, rule, AA_CHANGE_PROFILE, NULL); + if (!entry) + yyerror(_("Memory allocation error.")); + PDEBUG("change_profile,\n"); + $$ = entry; + }; + change_profile: TOK_CHANGE_PROFILE TOK_ARROW TOK_ID TOK_END_OF_RULE { struct cod_entry *entry; diff --git a/parser/tst/equality.sh b/parser/tst/equality.sh index 89a048eb9..700ac8baf 100755 --- a/parser/tst/equality.sh +++ b/parser/tst/equality.sh @@ -458,6 +458,10 @@ verify_binary_equality "Deny of ungranted perm" \ "/t { /foo/[abc] r, }" +verify_binary_equality "change_profile == change_profile -> **" \ + "/t { change_profile, }" \ + "/t { change_profile -> **, }" + if [ $fails -ne 0 -o $errors -ne 0 ] then printf "ERRORS: %d\nFAILS: %d\n" $errors $fails 2>&1 diff --git a/parser/tst/simple_tests/change_profile/bare_ok_1.sd b/parser/tst/simple_tests/change_profile/bare_ok_1.sd new file mode 100644 index 000000000..3ea58d28c --- /dev/null +++ b/parser/tst/simple_tests/change_profile/bare_ok_1.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile +#=EXRESULT PASS +# +/usr/bin/foo { + change_profile, +}