[apparmor] [PATCH 1/2] libaalogparse: Parse dbus-daemon audit messages

Seth Arnold seth.arnold at canonical.com
Fri Aug 9 06:39:01 UTC 2013


On Thu, Aug 08, 2013 at 10:22:11PM -0700, Tyler Hicks wrote:
> > > > +	{ /* Free existing arrays because exe= and comm= maps to the same
> > > > +	     aa_log_record member */
> > > > +	  free(ret_record->comm);
> > > > +	  ret_record->comm = $3;
> > > > +	}
> > > >  	| TOK_KEY_COMM TOK_EQUALS safe_string
> > > > -	{ ret_record->comm = $3;}
> > > > +	{ /* Free existing arrays because exe= and comm= maps to the same
> > > > +	     aa_log_record member */
> > > > +	  free(ret_record->comm);
> > > > +	  ret_record->comm = $3;
> > > > +	}
> > > 
> > > The actions for TOK_KEY_COMM and TOK_KEY_EXE are the same, we could
> > > combine them into one action block.

> Oops... Seth and I chatted this over in IRC and concluded that we can't
> combine these two actions. So, I've reverted this change.


So, here's my mistake. _Flex_ supports sharing actions via |:

    The first three rules share the fourth's action since they use the
    special ‘|’ action.

http://flex.sourceforge.net/manual/Actions.html

_Bison_ also uses | for "further matches for this rule", but the actions
aren't shared:

    If you don't specify an action for a rule, Bison supplies a default:
    $$ = $1. Thus, the value of the first symbol in the rule becomes the
    value of the whole rule.

http://www.gnu.org/software/bison/manual/bison.html#Actions


You live, and learn, and forget, and relearn. :)

Thanks, and sorry to Tyler for the bad advice in the first place.
-------------- 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/20130808/029ab47d/attachment.pgp>


More information about the AppArmor mailing list