[apparmor] [patch] aa.py: let parse_audit_allow also match comments
Kshitij Gupta
kgupta8592 at gmail.com
Sat Nov 8 16:32:45 UTC 2014
Hello,
On Sat, Nov 8, 2014 at 9:25 PM, Christian Boltz <apparmor at cboltz.de> wrote:
> Hello,
>
> Am Samstag, 8. November 2014 schrieb Kshitij Gupta:
> > On Sat, Nov 8, 2014 at 3:56 AM, Christian Boltz wrote:
> > > + comment = ' %s' % matches.group('comment').strip()
> >
> > Would the superfluous spaces be better dealt in the regex RE_EOL by
> > ignoring them from comment group?
> > That would save us many such calls.
>
> Indeed, good idea!
>
> Here's the follow-up patch to let RE_EOL strip whitespace from the
> comment:
>
> === modified file 'utils/apparmor/aa.py'
> --- utils/apparmor/aa.py 2014-11-08 15:47:39 +0000
> +++ utils/apparmor/aa.py 2014-11-08 15:53:23 +0000
> @@ -2613,7 +2613,7 @@
> ## Profile parsing Regex
> RE_AUDIT_DENY =
> '^\s*(?P<audit>audit\s+)?(?P<allow>allow\s+|deny\s+)?' # line start,
> optionally: leading whitespace, <audit> and <allow>/deny
> RE_OWNER = '(?P<owner>owner\s+)?' # optionally: <owner>
> -RE_EOL = '\s*(?P<comment>#.*)?$' # optional whitespace,
> optional <comment>, end of the line
> +RE_EOL = '\s*(?P<comment>#.*?)?\s*$' # optional
> whitespace, optional <comment>, optional whitespace, end of the line
> RE_COMMA_EOL = '\s*,' + RE_EOL # optional whitespace, comma +
> RE_EOL
>
> RE_PROFILE_START =
> re.compile('^\s*("?(/.+?)"??|(profile\s+"?(.+?)"??))\s+((flags=)?\((.+)\)\s+)?\{'
> + RE_EOL)
>
>
>
>
Thanks for the quick follow-up patch. :-)
Acked-by: Kshitij Gupta <kgupta8592 at gmail.com>.
Regards,
Kshitij Gupta
Regards,
>
> Christian Boltz
> --
> Key Signing Party? Was ist denn das?
> Kultiges Zusammensitzen und gemeinsames Murmeln magischer Zahlen.
> -- Gert Döring, FdI 95
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/apparmor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20141108/704c3096/attachment.html>
More information about the AppArmor
mailing list