[apparmor] [PATCH 04/13] Instead of using a special flags= token and keyword use TOK_CONDID

Kees Cook kees at ubuntu.com
Tue Feb 14 22:24:20 UTC 2012


On Tue, Feb 14, 2012 at 12:51:55PM -0800, John Johansen wrote:
> On 02/14/2012 11:10 AM, Kees Cook wrote:
> > On Tue, Feb 14, 2012 at 09:32:26AM -0800, John Johansen wrote:
> >> Signed-off-by: John Johansen <john.johansen at canonical.com>
> >> ---
> >>  parser/parser_lex.l  |   31 +++++++++++++------------------
> >>  parser/parser_yacc.y |    8 +++++++-
> >>  2 files changed, 20 insertions(+), 19 deletions(-)
> >>
> >> diff --git a/parser/parser_lex.l b/parser/parser_lex.l
> >> index bfcbd57..8f549c8 100644
> >> --- a/parser/parser_lex.l
> >> +++ b/parser/parser_lex.l
> >> @@ -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;
> >> +			}
> >> +
> > 
> > Why the relocation of this chunk? Seems better to keep it near the other
> > VARIABLE_NAME use...
> > 
> 
> Originally I did, but it got lifted and state shared as part of the mount
> patch, and actually had other modifications done as well.  I pulled most
> of those changes back into the original.
> 
> We could always rework it into a couple of patches but I guess I am just
> getting lazy

Hehe, no worries. Just curious, it's not really a blocker from my
perspective.

Acked-by: Kees Cook <kees at ubuntu.com>

-- 
Kees Cook



More information about the AppArmor mailing list