mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Add generic support extended conditional syntax
extended conditionals use a syntax of cond=value cond=(value1 value2) cond=(value1,value2) where the comma is optional and supported as such because the flags syntax used them The mount patch extends, and improves on this patch, the changes probably should have been separated out but ... Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Kees Cook <kees@ubuntu.com>
This commit is contained in:
parent
eabeb4f7b3
commit
613997fd7e
@ -213,6 +213,7 @@ ARROW ->
|
|||||||
LT_EQUAL <=
|
LT_EQUAL <=
|
||||||
|
|
||||||
%x SUB_NAME
|
%x SUB_NAME
|
||||||
|
%x EXTCOND_MODE
|
||||||
%x NETWORK_MODE
|
%x NETWORK_MODE
|
||||||
%x LIST_VAL_MODE
|
%x LIST_VAL_MODE
|
||||||
%x ASSIGN_MODE
|
%x ASSIGN_MODE
|
||||||
@ -306,6 +307,34 @@ LT_EQUAL <=
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<EXTCOND_MODE>{
|
||||||
|
{WS}+ { DUMP_PREPROCESS; /* Eat whitespace */ }
|
||||||
|
|
||||||
|
{EQUALS} {
|
||||||
|
DUMP_PREPROCESS;
|
||||||
|
return TOK_EQUALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
{OPEN_PAREN} {
|
||||||
|
DUMP_PREPROCESS;
|
||||||
|
PDEBUG("extcond listv\n");
|
||||||
|
/* Don't push state here as this is a transition
|
||||||
|
* start condition and we want to return to the start
|
||||||
|
* condition that invoked <EXTCOND_MODE> when
|
||||||
|
* SUB_NAME is done
|
||||||
|
*/
|
||||||
|
BEGIN(LIST_VAL_MODE);
|
||||||
|
return TOK_OPENPAREN;
|
||||||
|
}
|
||||||
|
|
||||||
|
[^\n] {
|
||||||
|
DUMP_PREPROCESS;
|
||||||
|
/* Something we didn't expect */
|
||||||
|
yyerror(_("Found unexpected character: '%s'"), yytext);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
<ASSIGN_MODE>{
|
<ASSIGN_MODE>{
|
||||||
{WS}+ { DUMP_PREPROCESS; /* Eat whitespace */ }
|
{WS}+ { DUMP_PREPROCESS; /* Eat whitespace */ }
|
||||||
|
|
||||||
@ -536,6 +565,18 @@ LT_EQUAL <=
|
|||||||
return TOK_OPENPAREN;
|
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} {
|
{VARIABLE_NAME} {
|
||||||
DUMP_PREPROCESS;
|
DUMP_PREPROCESS;
|
||||||
int token = get_keyword_token(yytext);
|
int token = get_keyword_token(yytext);
|
||||||
|
@ -78,6 +78,7 @@ void add_local_entry(struct codomain *cod);
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%token TOK_ID
|
%token TOK_ID
|
||||||
|
%token TOK_CONDID
|
||||||
%token TOK_CARET
|
%token TOK_CARET
|
||||||
%token TOK_OPEN
|
%token TOK_OPEN
|
||||||
%token TOK_CLOSE
|
%token TOK_CLOSE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user