[apparmor] [PATCH v2] Fix mount rule preprocessor output

Seth Arnold seth.arnold at canonical.com
Mon Jun 24 19:35:02 UTC 2013


On Mon, Jun 24, 2013 at 11:47:50AM -0700, Tyler Hicks wrote:
> Currently, mount rule preprocessor output is incorrect:
> 
> $ echo '/t { mount options=ro /s -> /d, }' | apparmor_parser -p
> /t { mountmount =ro /s -> /d, }
> $ echo '/t { mount options in (ro) /s -> /d, }' | apparmor_parser -p
> /t { mountmount  in (ro) /s -> /d, }
> 
> This is due to incorrect placement of DUMP_PREPROCESS in parser_lex.l.
> With this patch, the output is correct:
> 
> $ echo '/t { mount options=ro /s -> /d, }' | apparmor_parser -p
> /t { mount options=ro /s -> /d, }
> $ echo '/t { mount options in (ro) /s -> /d, }' | apparmor_parser -p
> /t { mount options in (ro) /s -> /d,
> 
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>

Woo, thanks for the fast test and turnaround :)

Acked-by: Seth Arnold <seth.arnold at canonical.com>

> ---
> 
> * Changes since v2:
>   - Add DUMP_PREPROCESS to second MOUNT_MODE branch
>   - Simplify examples in commit message to avoid line wrapping
>   - Add examples to the commit message showing the usage of the second
>     MOUNT_MODE branch
> 
>  parser/parser_lex.l | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/parser/parser_lex.l b/parser/parser_lex.l
> index 1258b01..539e16a 100644
> --- a/parser/parser_lex.l
> +++ b/parser/parser_lex.l
> @@ -286,6 +286,7 @@ LT_EQUAL	<=
>  				 * as bison may have requested the next
>  				 * token from the scanner
>  				 */
> +				DUMP_PREPROCESS;
>  				PDEBUG("conditional %s=\n", yytext);
>  				yylval.id = processid(yytext, yyleng);
>  				yy_push_state(EXTCOND_MODE);
> @@ -298,6 +299,7 @@ LT_EQUAL	<=
>  				 * as bison may have requested the next
>  				 * token from the scanner
>  				 */
> +				DUMP_PREPROCESS;
>  				PDEBUG("conditional %s=\n", yytext);
>  				yylval.id = processid(yytext, yyleng);
>  				yy_push_state(EXTCOND_MODE);
> @@ -704,7 +706,6 @@ LT_EQUAL	<=
>  			case TOK_MOUNT:
>  			case TOK_REMOUNT:
>  			case TOK_UMOUNT:
> -				DUMP_PREPROCESS;
>  				PDEBUG("Entering mount\n");
>  				yy_push_state(MOUNT_MODE);
>  				break;
> -- 
> 1.8.1.2
> 
> 
> -- 
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130624/dc364aec/attachment.pgp>


More information about the AppArmor mailing list