mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Yuck, fix up bogus type conversions. Also fix up some PDEBUG statements,
to make debugging why things are going wrong in specific examples easier.
This commit is contained in:
parent
61c61f9aab
commit
fc669861fe
1 changed files with 38 additions and 40 deletions
|
@ -240,8 +240,8 @@ LT_EQUAL <=
|
||||||
* a longer match). So now, when I want to
|
* a longer match). So now, when I want to
|
||||||
* match any random string, I go into a
|
* match any random string, I go into a
|
||||||
* separate state. */
|
* separate state. */
|
||||||
yylval = (YYSTYPE) processunquoted(yytext, yyleng);
|
yylval.id = processunquoted(yytext, yyleng);
|
||||||
PDEBUG("Found sub name: \"%s\"\n", yylval);
|
PDEBUG("Found sub name: \"%s\"\n", yylval.id);
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
|
@ -253,8 +253,8 @@ LT_EQUAL <=
|
||||||
* a longer match). So now, when I want to
|
* a longer match). So now, when I want to
|
||||||
* match any random string, I go into a
|
* match any random string, I go into a
|
||||||
* separate state. */
|
* separate state. */
|
||||||
yylval = (YYSTYPE) processquoted(yytext, yyleng);
|
yylval.id = processquoted(yytext, yyleng);
|
||||||
PDEBUG("Found sub name: \"%s\"\n", yylval);
|
PDEBUG("Found sub name: \"%s\"\n", yylval.id);
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
|
@ -274,8 +274,8 @@ LT_EQUAL <=
|
||||||
* a longer match). So now, when I want to
|
* a longer match). So now, when I want to
|
||||||
* match any random string, I go into a
|
* match any random string, I go into a
|
||||||
* separate state. */
|
* separate state. */
|
||||||
yylval = (YYSTYPE) processunquoted(yytext, yyleng);
|
yylval.id = processunquoted(yytext, yyleng);
|
||||||
PDEBUG("Found sub name: \"%s\"\n", yylval);
|
PDEBUG("Found sub name: \"%s\"\n", yylval.id);
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
|
@ -287,8 +287,8 @@ LT_EQUAL <=
|
||||||
* a longer match). So now, when I want to
|
* a longer match). So now, when I want to
|
||||||
* match any random string, I go into a
|
* match any random string, I go into a
|
||||||
* separate state. */
|
* separate state. */
|
||||||
yylval = (YYSTYPE) processquoted(yytext, yyleng);
|
yylval.id = processquoted(yytext, yyleng);
|
||||||
PDEBUG("Found sub name: \"%s\"\n", yylval);
|
PDEBUG("Found sub name: \"%s\"\n", yylval.id);
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,8 @@ LT_EQUAL <=
|
||||||
return TOK_EQUALS;
|
return TOK_EQUALS;
|
||||||
}
|
}
|
||||||
{KEYWORD} {
|
{KEYWORD} {
|
||||||
yylval = (YYSTYPE) strdup(yytext);
|
yylval.flag_id = strdup(yytext);
|
||||||
|
PDEBUG("Found flag: \"%s\"\n", yylval.flag_id);
|
||||||
return TOK_FLAG_ID;
|
return TOK_FLAG_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,14 +338,14 @@ LT_EQUAL <=
|
||||||
{WS}+ { /* Eat whitespace */ }
|
{WS}+ { /* Eat whitespace */ }
|
||||||
|
|
||||||
{ID}+ {
|
{ID}+ {
|
||||||
yylval = (YYSTYPE) processunquoted(yytext, yyleng);
|
yylval.var_val = processunquoted(yytext, yyleng);
|
||||||
PDEBUG("Found assignment value: \"%s\"\n", yylval);
|
PDEBUG("Found assignment value: \"%s\"\n", yylval.var_val);
|
||||||
return TOK_VALUE;
|
return TOK_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
{QUOTED_ID} {
|
{QUOTED_ID} {
|
||||||
yylval = (YYSTYPE) processquoted(yytext, yyleng);
|
yylval.var_val = processquoted(yytext, yyleng);
|
||||||
PDEBUG("Found assignment value: \"%s\"\n", yylval);
|
PDEBUG("Found assignment value: \"%s\"\n", yylval.var_val);
|
||||||
return TOK_VALUE;
|
return TOK_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +361,7 @@ LT_EQUAL <=
|
||||||
{WS}+ { /* Eat whitespace */ }
|
{WS}+ { /* Eat whitespace */ }
|
||||||
|
|
||||||
{ID}+ {
|
{ID}+ {
|
||||||
yylval = (YYSTYPE) strdup(yytext);
|
yylval.id = strdup(yytext);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
{END_OF_RULE} {
|
{END_OF_RULE} {
|
||||||
|
@ -369,8 +370,8 @@ LT_EQUAL <=
|
||||||
}
|
}
|
||||||
[^\n] {
|
[^\n] {
|
||||||
/* Something we didn't expect */
|
/* Something we didn't expect */
|
||||||
yylval = (YYSTYPE) strdup(yytext);
|
yylval.id = strdup(yytext);
|
||||||
yyerror(_("(network_mode) Found unexpected character: '%s'"), yylval);
|
yyerror(_("(network_mode) Found unexpected character: '%s'"), yylval.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
\r?\n {
|
\r?\n {
|
||||||
|
@ -380,8 +381,7 @@ LT_EQUAL <=
|
||||||
|
|
||||||
<CHANGE_PROFILE_MODE>{
|
<CHANGE_PROFILE_MODE>{
|
||||||
{ARROW} {
|
{ARROW} {
|
||||||
PDEBUG("Matched a arrow\n");
|
PDEBUG("Matched a change profile arrow\n");
|
||||||
yylval = (YYSTYPE) yytext;
|
|
||||||
return TOK_ARROW;
|
return TOK_ARROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,8 +393,8 @@ LT_EQUAL <=
|
||||||
* a longer match). So now, when I want to
|
* a longer match). So now, when I want to
|
||||||
* match any random string, I go into a
|
* match any random string, I go into a
|
||||||
* separate state. */
|
* separate state. */
|
||||||
yylval = (YYSTYPE) processunquoted(yytext, yyleng);
|
yylval.id = processunquoted(yytext, yyleng);
|
||||||
PDEBUG("Found sub name: \"%s\"\n", yylval);
|
PDEBUG("Found change profile name: \"%s\"\n", yylval.id);
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
|
@ -406,8 +406,8 @@ LT_EQUAL <=
|
||||||
* a longer match). So now, when I want to
|
* a longer match). So now, when I want to
|
||||||
* match any random string, I go into a
|
* match any random string, I go into a
|
||||||
* separate state. */
|
* separate state. */
|
||||||
yylval = (YYSTYPE) processquoted(yytext, yyleng);
|
yylval.id = processquoted(yytext, yyleng);
|
||||||
PDEBUG("Found sub name: \"%s\"\n", yylval);
|
PDEBUG("Found change profile quoted name: \"%s\"\n", yylval.id);
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
|
@ -435,13 +435,11 @@ LT_EQUAL <=
|
||||||
|
|
||||||
{SEPARATOR} {
|
{SEPARATOR} {
|
||||||
PDEBUG("Matched a separator\n");
|
PDEBUG("Matched a separator\n");
|
||||||
yylval = (YYSTYPE) yytext;
|
|
||||||
BEGIN(SUB_NAME);
|
BEGIN(SUB_NAME);
|
||||||
return TOK_SEP;
|
return TOK_SEP;
|
||||||
}
|
}
|
||||||
{ARROW} {
|
{ARROW} {
|
||||||
PDEBUG("Matched a arrow\n");
|
PDEBUG("Matched a arrow\n");
|
||||||
yylval = (YYSTYPE) yytext;
|
|
||||||
return TOK_ARROW;
|
return TOK_ARROW;
|
||||||
}
|
}
|
||||||
{EQUALS} {
|
{EQUALS} {
|
||||||
|
@ -459,12 +457,12 @@ LT_EQUAL <=
|
||||||
|
|
||||||
|
|
||||||
-?{NUMBER}[kKMG]? {
|
-?{NUMBER}[kKMG]? {
|
||||||
yylval = (YYSTYPE) strdup(yytext);
|
yylval.var_val = strdup(yytext);
|
||||||
return TOK_VALUE;
|
return TOK_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
{KEYWORD} {
|
{KEYWORD} {
|
||||||
yylval = (YYSTYPE) strdup(yytext);
|
yylval.id = strdup(yytext);
|
||||||
if (strcmp(yytext, "infinity") == 0)
|
if (strcmp(yytext, "infinity") == 0)
|
||||||
return TOK_VALUE;
|
return TOK_VALUE;
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
|
@ -489,14 +487,14 @@ LT_EQUAL <=
|
||||||
}
|
}
|
||||||
|
|
||||||
{SET_VARIABLE} {
|
{SET_VARIABLE} {
|
||||||
yylval = (YYSTYPE) strdup(yytext);
|
yylval.set_var = strdup(yytext);
|
||||||
PDEBUG("Found set variable %s\n", yylval);
|
PDEBUG("Found set variable %s\n", yylval.set_var);
|
||||||
return TOK_SET_VAR;
|
return TOK_SET_VAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
{BOOL_VARIABLE} {
|
{BOOL_VARIABLE} {
|
||||||
yylval = (YYSTYPE) strdup(yytext);
|
yylval.bool_var = strdup(yytext);
|
||||||
PDEBUG("Found boolean variable %s\n", yylval);
|
PDEBUG("Found boolean variable %s\n", yylval.bool_var);
|
||||||
return TOK_BOOL_VAR;
|
return TOK_BOOL_VAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,21 +507,21 @@ LT_EQUAL <=
|
||||||
return TOK_CLOSE;
|
return TOK_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
{PATHNAME} {
|
{PATHNAME} {
|
||||||
yylval = (YYSTYPE) processunquoted(yytext, yyleng);
|
yylval.id = processunquoted(yytext, yyleng);
|
||||||
PDEBUG("Found id: \"%s\"\n", yylval);
|
PDEBUG("Found id: \"%s\"\n", yylval.id);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
{QPATHNAME} {
|
{QPATHNAME} {
|
||||||
yylval = (YYSTYPE) processquoted(yytext, yyleng);
|
yylval.id = processquoted(yytext, yyleng);
|
||||||
PDEBUG("Found id: \"%s\"\n", yylval);
|
PDEBUG("Found id: \"%s\"\n", yylval.id);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
{MODES} {
|
{MODES} {
|
||||||
yylval = (YYSTYPE) strdup(yytext);
|
yylval.mode = strdup(yytext);
|
||||||
PDEBUG("Found modes: %s\n", yylval);
|
PDEBUG("Found modes: %s\n", yylval.mode);
|
||||||
return TOK_MODE;
|
return TOK_MODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,8 +548,8 @@ LT_EQUAL <=
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case -1:
|
case -1:
|
||||||
/* no token found */
|
/* no token found */
|
||||||
yylval = (YYSTYPE) processunquoted(yytext, yyleng);
|
yylval.id = processunquoted(yytext, yyleng);
|
||||||
PDEBUG("Found id: \"%s\"\n", yylval);
|
PDEBUG("Found (var) id: \"%s\"\n", yylval.id);
|
||||||
return TOK_ID;
|
return TOK_ID;
|
||||||
break;
|
break;
|
||||||
case TOK_PROFILE:
|
case TOK_PROFILE:
|
||||||
|
|
Loading…
Add table
Reference in a new issue