[apparmor] create-apparmor.vim.py - create_file_rule
Christian Boltz
apparmor at cboltz.de
Fri May 25 23:21:21 UTC 2012
Hello,
Am Mittwoch, 9. Mai 2012 schrieb Christian Boltz:
> as mentioned in the UDS chat, I'd like to have a create_file_rule
> function in create-apparmor.vim.py.
>
> Unfortunately Python is not one of the P* languages I "speak", which
> means I can't implement this myself :-( or at least I'd need more time
> for reading a "python for beginners" tutorial than for writhing code
> ;-)
LinuxTag has some advantages - for example, you meet people who can help
with python :-)
The attached patch moves the generation of file rules from
apparmor.vim.in to create-apparmor.vim.py. It also adds support for
- filenames in quotes
- reverse syntax (permissions first)
The patch also removes an outdated $Id header in apparmor.vim.in and
updates the copyright year.
Note: If you want to compare apparmor.vim with the "old" apparmor.vim,
temporarily comment out the "filename with quotes" and the two "reverse
syntax" lines in create_file_rule().
The code looks good to me and seems to work (I tested with some
profiles, but didn't test all corner cases), but maybe it isn't the
best-looking python code on the world ;-) (it's the first python I ever
wrote...) I'm always happy about improvements. However, I'd prefer to
do it incremental - in other words: first commit this patch and then
apply a "cleanup" patch. That makes checking the changes easier.
Regards,
Christian Boltz
--
»Microsoft Outlook Express - Designed to enable Virus replication.«
[http://www.microsoft.com/mac/products/office/2001/virus_alert.asp]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apparmor.vim-filerule.diff
Type: text/x-patch
Size: 9088 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20120526/bef96a93/attachment.bin>
More information about the AppArmor
mailing list