[apparmor] [PATCH 2/8] refactor parser prefix parsing to remove execess code

Tyler Hicks tyhicks at canonical.com
Thu Sep 12 20:46:46 UTC 2013


On 2013-09-12 12:52:23, Steve Beattie wrote:
> On Thu, Sep 12, 2013 at 12:40:47PM -0700, Steve Beattie wrote:
> > On Wed, Sep 11, 2013 at 01:47:41AM -0700, Tyler Hicks wrote:
> > > From: John Johansen <john.johansen at canonical.com>
> > > 
> > > Signed-off-by: John Johansen <john.johansen at canonical.com>
> > 
> > Acked-by: Steve Beattie <steve at nxnw.org> as it's a nice cleanup as is,
> > but Tyler, I noticed that in merging in against the dbus code already
> > committed, you didn't make the same opt_prefix simplification for
> > 'dbus_rule' as John did for e.g. 'mnt_rule' or 'capability'. One of
> > us should probably do that (I can if you're busy with other things).
> 
> In fact, here's what I think such a patch would look like:
> 
> Subject: parser - finish prefix refactoring for dbus rules
> 
> Signed-off-by: Steve Beattie <steve at nxnw.org>

Thanks! I verified that the parser tests still pass.

Acked-by: Tyler Hicks <tyhicks at canonical.com>

This doesn't conflict with any of the other C++ patches, so I think it
is safe to commit it to trunk when you get a chance.

Tyler

> ---
>  parser/parser_yacc.y |   18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> Index: b/parser/parser_yacc.y
> ===================================================================
> --- a/parser/parser_yacc.y
> +++ b/parser/parser_yacc.y
> @@ -667,19 +667,13 @@ rules:  rules opt_prefix mnt_rule
>  		$$ = $1;
>  	}
>  
> -rules:  rules opt_audit_flag TOK_DENY dbus_rule
> +rules:  rules opt_prefix dbus_rule
>  	{
> -		$4->deny = $4->mode;
> -		if ($2)
> -			$4->audit = $4->mode;
> -		$4->next = $1->dbus_ents;
> -		$1->dbus_ents = $4;
> -		$$ = $1;
> -	}
> -
> -rules: rules opt_audit_flag dbus_rule
> -	{
> -		if ($2)
> +		if ($2.owner)
> +			yyerror(_("owner prefix not allow on dbus rules"));
> +		if ($2.deny)
> +			$3->deny = $3->mode;
> +		if ($2.audit)
>  			$3->audit = $3->mode;
>  		$3->next = $1->dbus_ents;
>  		$1->dbus_ents = $3;
> 
> -- 
> Steve Beattie
> <sbeattie at ubuntu.com>
> http://NxNW.org/~steve/



> -- 
> 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: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130912/3996ee29/attachment-0001.pgp>


More information about the AppArmor mailing list