mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 01:57:43 +00:00
Instead of using a special flags= token and keyword use TOK_CONDID
Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Kees Cook <kees@ubuntu.com>
This commit is contained in:
parent
613997fd7e
commit
def8c20168
@ -192,7 +192,6 @@ QUOTED_ID \"{ALLOWED_QUOTED_ID}*\"
|
||||
|
||||
IP {NUMBER}\.{NUMBER}\.{NUMBER}\.{NUMBER}
|
||||
|
||||
FLAGS flags{WS}*=?{WS}*
|
||||
HAT hat{WS}*
|
||||
PROFILE profile{WS}*
|
||||
KEYWORD [[:alpha:]_]+
|
||||
@ -254,6 +253,19 @@ LT_EQUAL <=
|
||||
if ( !YY_CURRENT_BUFFER ) yyterminate();
|
||||
}
|
||||
|
||||
{VARIABLE_NAME}/{WS}*={WS}* {
|
||||
/* we match to the = in the lexer so that
|
||||
* can switch scanner state. By the time
|
||||
* the parser see the = it may be to late
|
||||
* as bison may have requested the next
|
||||
* token from the scanner
|
||||
*/
|
||||
PDEBUG("conditional %s=\n", yytext);
|
||||
yylval.id = processid(yytext, yyleng);
|
||||
yy_push_state(EXTCOND_MODE);
|
||||
return TOK_CONDID;
|
||||
}
|
||||
|
||||
<SUB_NAME>{
|
||||
({IDS}|{QUOTED_ID}) {
|
||||
/* Ugh, this is a gross hack. I used to use
|
||||
@ -535,11 +547,6 @@ LT_EQUAL <=
|
||||
return TOK_MODE;
|
||||
}
|
||||
|
||||
{FLAGS} {
|
||||
DUMP_PREPROCESS;
|
||||
return TOK_FLAGS;
|
||||
}
|
||||
|
||||
{HAT} {
|
||||
DUMP_PREPROCESS;
|
||||
yy_push_state(SUB_NAME);
|
||||
@ -565,18 +572,6 @@ LT_EQUAL <=
|
||||
return TOK_OPENPAREN;
|
||||
}
|
||||
|
||||
{VARIABLE_NAME}/{WS}*={WS}* {
|
||||
/* we match to the = in the lexer so that
|
||||
* can switch scanner state. By the time
|
||||
* the parser see the = it may be to late
|
||||
* as bison may have requested the next
|
||||
* token from the scanner
|
||||
*/
|
||||
yylval.id = processid(yytext, yyleng);
|
||||
yy_push_state(EXTCOND_MODE);
|
||||
return TOK_CONDID;
|
||||
}
|
||||
|
||||
{VARIABLE_NAME} {
|
||||
DUMP_PREPROCESS;
|
||||
int token = get_keyword_token(yytext);
|
||||
|
@ -162,6 +162,7 @@ void add_local_entry(struct codomain *cod);
|
||||
}
|
||||
|
||||
%type <id> TOK_ID
|
||||
%type <id> TOK_CONDID
|
||||
%type <mode> TOK_MODE
|
||||
%type <fmode> file_mode
|
||||
%type <cod> profile_base
|
||||
@ -398,7 +399,12 @@ flags: { /* nothing */
|
||||
};
|
||||
|
||||
opt_flags: { /* nothing */ $$ = 0; }
|
||||
| TOK_FLAGS { $$ = 1; }
|
||||
| TOK_CONDID TOK_EQUALS
|
||||
{
|
||||
if (strcmp($1, "flags") != 0)
|
||||
yyerror("expected flags= got %s=", $1);
|
||||
$$ = 1;
|
||||
}
|
||||
|
||||
flags: opt_flags TOK_OPENPAREN flagvals TOK_CLOSEPAREN
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user