[apparmor] [PATCH 6/9] Update parsing of the 'hat' and 'profile' keyword to use SUB_NAME

John Johansen john.johansen at canonical.com
Wed Jan 4 20:53:54 UTC 2012


On 01/03/2012 11:57 AM, Steve Beattie wrote:
> On Tue, Dec 27, 2011 at 07:01:49PM -0800, John Johansen wrote:
>> Change how we handle the parsing of the hat and profile keywords this allows
>> us to get rid of the SUB_NAME2 start condition because the the whitespace
>> that is allowed by these rules are now consumed by matching the keyword
>>
>> Signed-off-by: John Johansen<john.johansen at canonical.com>
>> ---
>>   parser/parser_lex.l  |   39 +++++++++------------------------------
>>   parser/parser_misc.c |    1 -
>>   2 files changed, 9 insertions(+), 31 deletions(-)
>>
>> diff --git a/parser/parser_lex.l b/parser/parser_lex.l
>> index 5cb24fb..64b6a2e 100644
>> --- a/parser/parser_lex.l
>> +++ b/parser/parser_lex.l
>> @@ -186,7 +186,8 @@ IP		{NUMBER}\.{NUMBER}\.{NUMBER}\.{NUMBER}
>>   ALLOWED_QUOTED_ID 	[^\0"]|\\\"
>>   QUOTED_ID	\"{ALLOWED_QUOTED_ID}*\"
>>
>> -HAT		hat[ \t]+
>> +HAT		hat{WS}*
>> +PROFILE		profile{WS}*
>
> Should these match {WS}+ to ensure there's a trailing space separator?

hrmm that might have been better, but actually shouldn't be necessary.  In fact
I am trying to figure out why we are matching to white space at all.  And why
it just didn't get folded into {VARIABLE_NAME} below

>
>>   KEYWORD         [[:alpha:]_]+
>>   VARIABLE_NAME	[[:alpha:]][[:alnum:]_]*
>>   SET_VAR_PREFIX  @
>
>
>




More information about the AppArmor mailing list