[apparmor] [PATCH 2/8] refactor parser prefix parsing to remove execess code
Steve Beattie
steve at nxnw.org
Thu Sep 12 19:52:23 UTC 2013
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>
---
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/
-------------- 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/2f5ada09/attachment.pgp>
More information about the AppArmor
mailing list